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

John Machin sjmachin at lexicon.net
Fri Jan 16 23:26:31 EST 2009


On Jan 17, 3:08 pm, Steve Holden <st... at holdenweb.com> wrote:
> Giampaolo Rodola' wrote:
> > On 17 Gen, 04:43, Terry Reedy <tjre... at udel.edu> wrote:
> >> Giampaolo Rodola' wrote:
> >>> That would help to avoid replacing "" with b"" almost everywhere in my
> >>> code.
> >> Won't 2to3 do that for you?
>
> > I used 2to3 against my code but it didn't cover the "" -> b""
> > conversion (and I doubt it is able to do so, anyway).
>
> Note that if you are using 2.6 you should first convert your "" quotes
> to b"" - this won't make any practical difference, but then you will be
> able to run 2to3 on your code and (one hopes) covert for 3.0 automatically.

Perhaps before we get too far down the track of telling the OP what he
should do, we should ask him a little about his intentions:

Is he porting to 3.0 and abandoning 2.x support completely?
[presumably unlikely]
So then what is the earliest 2.x that he wants to support at the same
time as 3.x? [presumably at least 2.5]
Does he intend to maintain two separate codebases, one 2.x and the
other 3.x?
Else does he intend to maintain just one codebase written in some 2.x
dialect and using 2to3 plus sys.version-dependent code for the things
that 2to3 can't/doesn't handle?

Cheers,
John



More information about the Python-list mailing list