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

Giampaolo Rodola' gnewsg at
Sat Jan 17 14:58:35 CET 2009

On 17 Gen, 05:26, John Machin <sjmac... at> wrote:
> On Jan 17, 3:08 pm, Steve Holden <st... at> wrote:
> > Giampaolo Rodola' wrote:
> > > On 17 Gen, 04:43, Terry Reedy <tjre... at> 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]

I currently support Python versions from 2.3 to 2.6 by using un unique
My idea is to support 3.x starting from the last upcoming release.

> Does he intend to maintain two separate codebases, one 2.x and the
> other 3.x?

I think I have no other choice.
Why? Is theoretically possible to maintain an unique code base for
both 2.x and 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?

I don't think it would worth the effort.

> Cheers,
> John

Thanks a lot

--- Giampaolo

More information about the Python-list mailing list