[IronPython] Minor bug in conversion of str to bytes?

Robert Smallshire robert at smallshire.org.uk
Fri May 29 19:29:28 CEST 2009


Hello,

Lets create a bytes instance from a str, and convert it back to a str.

>>> a = bytes(ord(c) for c in "Hello World")
>>> a
b'Hello World'
>>> str(a)
"b'Hello World'"

As you can see, the leading b and the quotes become part of the string,
which is unexpected.  I guess the conversion is using __repr__ where it
should use __str__.

Cheers,

Rob




More information about the Ironpython-users mailing list