Skip to content

bytes objects lack a decode method in smaller non-Express builds #384

Closed
@gpshead

Description

@gpshead

The decode method for converting from bytes to str is missing in non-Express builds. This makes it awkward to take data from I/O and print it. It seems like this should exist, obviously the codec is ignored on a microcontroller but being able to switch immutable data types from one that iterates as ints to one that is printable and iterates as one character strings is desirable. Depending on the micropython gc internals both could share the same data buffer behind the scenes (I haven't looked inside that box yet...).

Workaround, a silly looking: ''.join(chr(b) for b in bytes_data)

Noticed when using the Feather M0 Basic 2.1.0 circuitpython release. I had to work around this when moving code over from where I developed it on an Express.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions