Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Perl 6 have an equivalent to Python's bytearray method?

I can't find bytearray method or similar in Raku doc as in Python. In Python, the bytearray defined as this:

class bytearray([source[, encoding[, errors]]])

Return a new array of bytes. The bytearray class is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the str type has, see String Methods.

Does Raku should provide this method or some module?

like image 735
chenyf Avatar asked Jun 24 '18 10:06

chenyf


1 Answers

I think you're looking for Buf - a mutable sequence of (usually unsigned) integers. Opening a file with :bin returns a Buf.

like image 187
brian d foy Avatar answered Sep 20 '22 20:09

brian d foy