[Ironpython-users] binary strings in 2.7.2 alpha?

Jeff Hardy jdhardy at gmail.com
Sat Feb 4 02:15:19 CET 2012


On Fri, Feb 3, 2012 at 5:00 PM, Daniel Fernandez
<fernandez_dan2 at hotmail.com> wrote:
> Hi All,
>
> I'm playing with open source package  and I am getting an error with prefix
> "b" with a string literal with expected str and got bytes. Here is a simple
> example, IronPython 2.7.2 alpha I get the following
>
>>>> type(b"/")
> <type 'bytes'>
>
> In CPython 2.7.2 I get the following
>
>>>> type(b"/")
> <type 'str'>
>
> I searched for more information on this but I didn't find alot on it. I did
> find one site indicating that this is a python 3.0 feature, I just wanted to
> confirm.

Yeah, IronPython returns bytes for b'' (like Python 3) because its
strings are unicode. On the plus side, it means that what you're
testing probably has some changes to be made for Python 3 support.

- Jeff


More information about the Ironpython-users mailing list