Totally confused by the str/bytes/unicode differences introduced in Pythyon 3.x

Giampaolo Rodola' gnewsg at gmail.com
Sat Jan 17 03:54:51 CET 2009


On 17 Gen, 03:40, Steve Holden <st... at holdenweb.com> wrote:
> Giampaolo Rodola' wrote:
> > On 17 Gen, 02:24, MRAB <goo... at mrabarnett.plus.com> wrote:
>
> >> If you're truly working with strings of _characters_ then
> >> 'str' is what you need, but if you're working with strings of _bytes_
> >> then 'bytes' is what you need.
>
> > I work with string of characters but to convert bytes into string I
> > need to specify an encoding and that's what confuses me.
> > Before there was no need to deal with that.
>
> I don't yet understand why you feel you have to convert what you receive
> to a string. In Python 3.0 bytes is the same as a string in 2.6, for
> most practical purposes.
>
> regards
>  Steve

That would help to avoid replacing "" with b"" almost everywhere in my
code.


--- Giampaolo
http://code.google.com/p/pyftpdlib



More information about the Python-list mailing list