Re: [Python-Dev] bytes type discussion

2006-02-21 Thread Barry Warsaw
On Fri, 2006-02-17 at 00:43 -0500, Steve Holden wrote: Fredrik Lundh wrote: Barry Warsaw wrote: We know at least there will never be a 2.10, so I think we still have time. because there's no way to count to 10 if you only have one digit? we used to think that back when the

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Stephen J. Turnbull
Guido == Guido van Rossum [EMAIL PROTECTED] writes: Guido I think that the implementation of encoding-guessing or Guido auto-encoding-upgrade techniques should be left out of the Guido standard library design for now. As far as I can see, little new design is needed. There's no

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Steve Holden
Fredrik Lundh wrote: Barry Warsaw wrote: We know at least there will never be a 2.10, so I think we still have time. because there's no way to count to 10 if you only have one digit? we used to think that back when the gas price was just below 10 SEK/L, but they found a way... IIRC

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Bengt Richter
On Fri, 17 Feb 2006 00:43:50 -0500, Steve Holden [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Barry Warsaw wrote: We know at least there will never be a 2.10, so I think we still have time. because there's no way to count to 10 if you only have one digit? we used to think that back

Re: [Python-Dev] bytes type discussion

2006-02-17 Thread Fredrik Lundh
Bengt Richter wrote: because there's no way to count to 10 if you only have one digit? we used to think that back when the gas price was just below 10 SEK/L, but they found a way... IIRC Guido is on record as saying There will be no Python 2.10 because I hate the ambiguity of

Re: [Python-Dev] bytes type discussion

2006-02-16 Thread Adam Olsen
On 2/15/06, Martin v. Löwis [EMAIL PROTECTED] wrote: Adam Olsen wrote: Making it an error to have 8-bit str literals in 2.x would help educate the user that they will change behavior in 3.0 and not be 8-bit str literals anymore. You would like to ban string literals from the language?

Re: [Python-Dev] bytes type discussion

2006-02-16 Thread Fredrik Lundh
Barry Warsaw wrote: We know at least there will never be a 2.10, so I think we still have time. because there's no way to count to 10 if you only have one digit? we used to think that back when the gas price was just below 10 SEK/L, but they found a way... /F

Re: [Python-Dev] bytes type discussion

2006-02-16 Thread Jack Diederich
On Thu, Feb 16, 2006 at 06:13:53PM +0100, Fredrik Lundh wrote: Barry Warsaw wrote: We know at least there will never be a 2.10, so I think we still have time. because there's no way to count to 10 if you only have one digit? we used to think that back when the gas price was just below

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Martin v. Löwis
Adam Olsen wrote: My assumption is these would become errors in 3.x. bytes(str) is only needed so you can do bytes(uabc.encode('utf-8')) and have it work in 2.x and 3.x. I think the proposal for bytes(seq) to mean bytes(map(ord, seq)) was meant to be valid for both 2.x and 3.x, on the grounds

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Martin v. Löwis
Greg Ewing wrote: If the protocol has been sensibly designed, that shouldn't happen, since everything up to the coding marker should be ascii (or some other protocol-defined initial coding). XML, for one protocol, requires you to restart over. The initial sequence could be UTF-16, or it could

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Adam Olsen
On 2/15/06, Martin v. Löwis [EMAIL PROTECTED] wrote: Adam Olsen wrote: (I wonder if maybe they should be an error in 2.x as well. Source encoding is for unicode literals, not str literals.) Source encoding applies to the entire source code, including (byte) string literals, comments,

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Nick Coghlan
Bob Ippolito wrote: On Feb 14, 2006, at 4:17 PM, Guido van Rossum wrote: (Why would you even think about views here? They are evil.) I mention views because that's what numpy/Numeric/numarray/etc. do... It's certainly convenient at times to have that functionality, for example, to work

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Stephen J. Turnbull
Fred == Fred L Drake, [EMAIL PROTECTED] writes: Fred On Tuesday 14 February 2006 22:34, Greg Ewing wrote: Seems to me this is a case where you want to be able to change encodings in the middle of reading the stream. You start off reading the data as ascii, and once you've

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
On Tue, 14 Feb 2006 15:13:25 -0800, Guido van Rossum [EMAIL PROTECTED] wrote: I'm about to send 6 or 8 replies to various salient messages in the PEP 332 revival thread. That's probably a sign that there's still a lot to be sorted out. In the mean time, to save you reading through all those

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
On Tue, 14 Feb 2006 19:41:07 -0500, Raymond Hettinger [EMAIL PROTECTED] wrote: [Guido van Rossum] Somewhat controversial: - bytes(abc) == bytes(map(ord, abc)) At first glance, this seems obvious and necessary, so if it's somewhat controversial, then I'm missing something. What's the issue?

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Fredrik Lundh
Guido van Rossum wrote: - it's probably too big to attempt to rush this into 2.5 After reading some of the discussion, and seen some of the arguments, I'm beginning to feel that we need working code to get this right. It would be nice if we could get a bytes() type into the first alpha, so the

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Thomas Wouters
On Wed, Feb 15, 2006 at 11:28:59PM +0100, Fredrik Lundh wrote: After reading some of the discussion, and seen some of the arguments, I'm beginning to feel that we need working code to get this right. It would be nice if we could get a bytes() type into the first alpha, so the design can get

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Fredrik Lundh
Thomas Wouters wrote: After reading some of the discussion, and seen some of the arguments, I'm beginning to feel that we need working code to get this right. It would be nice if we could get a bytes() type into the first alpha, so the design can get some real-world exposure in

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Guido van Rossum
I'm actually assuming to put this off until 2.6 anyway. On 2/15/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Thomas Wouters wrote: After reading some of the discussion, and seen some of the arguments, I'm beginning to feel that we need working code to get this right. It would be nice

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Fredrik Lundh
Guido wrote: I'm actually assuming to put this off until 2.6 anyway. makes sense. (but will there be a 2.6? isn't it time to start hacking on 3.0?) /F ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Barry Warsaw
On Thu, 2006-02-16 at 01:09 +0100, Fredrik Lundh wrote: (but will there be a 2.6? isn't it time to start hacking on 3.0?) We know at least there will never be a 2.10, so I think we still have time. -Barry signature.asc Description: This is a digitally signed message part

Re: [Python-Dev] bytes type discussion

2006-02-15 Thread Bengt Richter
On Wed, 15 Feb 2006 15:20:16 -0800, Guido van Rossum [EMAIL PROTECTED] wrote: I'm actually assuming to put this off until 2.6 anyway. On 2/15/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Thomas Wouters wrote: After reading some of the discussion, and seen some of the arguments, I'm

[Python-Dev] bytes type discussion

2006-02-14 Thread Guido van Rossum
I'm about to send 6 or 8 replies to various salient messages in the PEP 332 revival thread. That's probably a sign that there's still a lot to be sorted out. In the mean time, to save you reading through all those responses, here's a summary of where I believe I stand. Let's continue the

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Bob Ippolito
On Feb 14, 2006, at 3:13 PM, Guido van Rossum wrote: I'm about to send 6 or 8 replies to various salient messages in the PEP 332 revival thread. That's probably a sign that there's still a lot to be sorted out. In the mean time, to save you reading through all those responses, here's a

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Guido van Rossum
On 2/14/06, Bob Ippolito [EMAIL PROTECTED] wrote: On Feb 14, 2006, at 3:13 PM, Guido van Rossum wrote: - we need a new PEP; PEP 332 won't cut it - no b... literal - bytes objects are mutable - bytes objects are composed of ints in range(256) - you can pass any iterable of ints

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Thomas Wouters
On Tue, Feb 14, 2006 at 03:13:25PM -0800, Guido van Rossum wrote: Martin von Loewis's alternative for the very controversial set is to disallow an encoding argument and (I believe) also to disallow Unicode arguments. In 3.0 this would leave us with s.encode(encoding) as the only way to

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Raymond Hettinger
[Guido van Rossum] Somewhat controversial: - bytes(abc) == bytes(map(ord, abc)) At first glance, this seems obvious and necessary, so if it's somewhat controversial, then I'm missing something. What's the issue? Raymond ___ Python-Dev mailing

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Martin v. Löwis
Bob Ippolito wrote: Martin von Loewis's alternative for the very controversial set is to disallow an encoding argument and (I believe) also to disallow Unicode arguments. In 3.0 this would leave us with s.encode(encoding) as the only way to convert a string (which is always unicode) to bytes. The

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Bob Ippolito
On Feb 14, 2006, at 4:17 PM, Guido van Rossum wrote: On 2/14/06, Bob Ippolito [EMAIL PROTECTED] wrote: On Feb 14, 2006, at 3:13 PM, Guido van Rossum wrote: - we need a new PEP; PEP 332 won't cut it - no b... literal - bytes objects are mutable - bytes objects are composed of ints in

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Martin v. Löwis
Raymond Hettinger wrote: - bytes(abc) == bytes(map(ord, abc)) At first glance, this seems obvious and necessary, so if it's somewhat controversial, then I'm missing something. What's the issue? There is an implicit Latin-1 assumption in that code. Suppose you do # -*- coding: koi-8r -*-

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Greg Ewing
Thomas Wouters wrote: The encoding of network streams or files may be entirely unknown beforehand, and depend on the content: a content-encoding, a META EQUIV HTML tag. Will bytes-strings get string methods for easy searching of content descriptors? Seems to me this is a case where you want

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Travis E. Oliphant
Guido van Rossum wrote: I'm about to send 6 or 8 replies to various salient messages in the PEP 332 revival thread. That's probably a sign that there's still a lot to be sorted out. In the mean time, to save you reading through all those responses, here's a summary of where I believe I stand.

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Greg Ewing
Fred L. Drake, Jr. wrote: The proper response in this case is often to re-start decoding with the correct encoding, since some of the data extracted so far may have been decoded incorrectly. If the protocol has been sensibly designed, that shouldn't happen, since everything up to the coding

Re: [Python-Dev] bytes type discussion

2006-02-14 Thread Fred L. Drake, Jr.
On Wednesday 15 February 2006 01:44, Greg Ewing wrote: If the protocol has been sensibly designed, that shouldn't happen, since everything up to the coding marker should be ascii (or some other protocol-defined initial coding). Indeed. For protocols that are not sensibly designed (or if