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

2009-01-18 Thread John Machin
On Jan 18, 2:02 pm, Terry Reedy wrote: > John Machin wrote: > > On Jan 18, 9:10 am, Terry Reedy wrote: > >> Martin v. Löwis wrote: > > 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 poss

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

2009-01-17 Thread Terry Reedy
John Machin wrote: On Jan 18, 9:10 am, Terry Reedy wrote: Martin v. Löwis wrote: 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? That is certainl

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

2009-01-17 Thread Terry Reedy
John Machin wrote: On Jan 18, 9:10 am, Terry Reedy wrote: Martin v. Löwis wrote: 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? That is certainl

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

2009-01-17 Thread John Machin
On Jan 18, 9:10 am, Terry Reedy wrote: > Martin v. Löwis wrote: > >>> 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? > > > That i

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

2009-01-17 Thread Terry Reedy
Martin v. Löwis wrote: 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? That is certainly possible! One might have to make tradeoffs wrt. readabilit

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

2009-01-17 Thread Martin v. Löwis
>> 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? That is certainly possible! One might have to make tradeoffs wrt. readability sometimes,

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

2009-01-17 Thread Giampaolo Rodola'
On 17 Gen, 05:26, John Machin wrote: > On Jan 17, 3:08 pm, Steve Holden wrote: > > > Giampaolo Rodola' wrote: > > > On 17 Gen, 04:43, Terry Reedy wrote: > > >> Giampaolo Rodola' wrote: > > >>> That would help to avoid replacing "" with b"" almost everywhere in my > > >>> code. > > >> Won't 2to3

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

2009-01-16 Thread John Machin
On Jan 17, 3:08 pm, Steve Holden wrote: > Giampaolo Rodola' wrote: > > On 17 Gen, 04:43, Terry Reedy 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

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

2009-01-16 Thread Steve Holden
Giampaolo Rodola' wrote: > On 17 Gen, 04:43, Terry Reedy 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 dou

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

2009-01-16 Thread Giampaolo Rodola'
On 17 Gen, 04:43, Terry Reedy 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).

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

2009-01-16 Thread Terry Reedy
Giampaolo Rodola' wrote: That would help to avoid replacing "" with b"" almost everywhere in my code. Won't 2to3 do that for you? -- http://mail.python.org/mailman/listinfo/python-list

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

2009-01-16 Thread Giampaolo Rodola'
On 17 Gen, 03:40, Steve Holden wrote: > Giampaolo Rodola' wrote: > > On 17 Gen, 02:24, MRAB 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 stri

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

2009-01-16 Thread Steve Holden
Giampaolo Rodola' wrote: > On 17 Gen, 02:24, MRAB 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

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

2009-01-16 Thread Giampaolo Rodola'
On 17 Gen, 03:09, Steven D'Aprano wrote: > On Fri, 16 Jan 2009 17:32:17 -0800, Giampaolo Rodola' wrote: > > On 17 Gen, 02:24, MRAB 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 > >

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

2009-01-16 Thread Steven D'Aprano
On Fri, 16 Jan 2009 17:32:17 -0800, Giampaolo Rodola' wrote: > On 17 Gen, 02:24, MRAB 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 charac

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

2009-01-16 Thread Christian Heimes
Giampaolo Rodola' schrieb: > 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. Why do you have to deal with unicode data? IIRC ftp uses ASCII only text so you can stick to byt

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

2009-01-16 Thread Giampaolo Rodola'
On 17 Gen, 02:24, MRAB 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 t

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

2009-01-16 Thread MRAB
Giampaolo Rodola' wrote: > Hi, I'm sure the message I'm going to write will seem quite dumb to > most people but I really don't understand the str/bytes/unicode > differences introduced in Python 3.0 so be patient. What I'm trying > to do is porting pyftpdlib to Python 3.x. I don't want to suppor

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

2009-01-16 Thread Christian Heimes
Giampaolo Rodola' schrieb: > Now. The basic difference is that socket.recv() returns a bytes object > instead of a string object and that's the thing which confuses me > mainly. > My question is: is there a way to convert that bytes object into > exactly *the same thing* returned by socket.recv() i

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

2009-01-16 Thread Giampaolo Rodola'
Hi, I'm sure the message I'm going to write will seem quite dumb to most people but I really don't understand the str/bytes/unicode differences introduced in Python 3.0 so be patient. What I'm trying to do is porting pyftpdlib to Python 3.x. I don't want to support Unicode. I don't want pyftpdlib