Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-20 Thread Aahz
On Sat, Jan 19, 2008, Guido van Rossum wrote: I believe that a constraint should be that by default (without -3 or a __future__ import) str and bytes should be the same thing. Or, another way of looking at this, reads from binary files and reads from sockets (and other similar things, like

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-20 Thread Guido van Rossum
On Jan 20, 2008 6:56 AM, Aahz [EMAIL PROTECTED] wrote: On Sat, Jan 19, 2008, Guido van Rossum wrote: I believe that a constraint should be that by default (without -3 or a __future__ import) str and bytes should be the same thing. Or, another way of looking at this, reads from binary

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Christian Heimes
Neil Schemenauer wrote: I like this solution because of its simplicity. I've implemented and submitted the feature yesterday: Python 2.6a0 (trunk:60048M, Jan 18 2008, 19:08:16) [GCC 4.2.1 (Ubuntu 4.2.1-5ubuntu4)] on linux2 Type help, copyright, credits or license for more information. b'a' 'a'

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Neil Schemenauer
Guido van Rossum [EMAIL PROTECTED] wrote: bytes is an alias for str (not even a subclass) b is an alias for One advantage of a subclass is that there could be a flag that warns about combining bytes and unicode data. For example, bx + uy would produce a warning. As someone who writes

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 10:53 AM, Neil Schemenauer [EMAIL PROTECTED] wrote: Guido van Rossum [EMAIL PROTECTED] wrote: bytes is an alias for str (not even a subclass) b is an alias for One advantage of a subclass is that there could be a flag that warns about combining bytes and unicode data. For

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread glyph
On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: There is no way to know whether that return value means text or data (plenty of apps legitimately read text straight off a socket in 2.x), IMHO, this is a stretch of the word legitimately ;-). If you're reading from a socket, what you're getting

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread Guido van Rossum
On Jan 19, 2008 5:54 PM, [EMAIL PROTECTED] wrote: On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: There is no way to know whether that return value means text or data (plenty of apps legitimately read text straight off a socket in 2.x), IMHO, this is a stretch of the word legitimately ;-). If

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-19 Thread glyph
On 04:26 am, [EMAIL PROTECTED] wrote: On Jan 19, 2008 5:54 PM, [EMAIL PROTECTED] wrote: On 19 Jan, 07:32 pm, [EMAIL PROTECTED] wrote: Starting with the most relevant bit before getting off into digressions that may not interest most people: Why can't we get that warning in -3 mode just the

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Christian Heimes
Guido van Rossum wrote: Oh, you won't. Just don't use the -3 command-line flag and don't put from __future__ import whatever at the top of your modules, and you won't have to change your ways at all. You can continue to distribute your packages in 2.5 syntax that will also work with 2.6, and

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Christian Heimes
Guido van Rossum wrote: I don't think any of that is necessary. I would rather have the following two in the language by default (see my response to Terry and Raymond): bytes is an alias for str (not even a subclass) b is an alias for Ah, you like to keep it simple. The aliases are easily

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Guido van Rossum
On Jan 18, 2008 12:27 AM, Christian Heimes [EMAIL PROTECTED] wrote: Guido van Rossum wrote: Oh, you won't. Just don't use the -3 command-line flag and don't put from __future__ import whatever at the top of your modules, and you won't have to change your ways at all. You can continue to

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Guido van Rossum
On Jan 17, 2008 11:24 PM, Thomas Heller [EMAIL PROTECTED] wrote: Is the bytes type required for PEP3118 'Revising the buffer protocol'? I don't think so. I would like to see this PEP backported (but keep the old 'buffer' of course for b/w compatibility). Whenever this PEP talks about bytes we

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Guido van Rossum
On Jan 17, 2008 9:30 PM, Terry Reedy [EMAIL PROTECTED] wrote: Guido van Rossum [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Is it reading text or binary data from stream blah? We can't tell. If | it's meant to be reading text, 2to3 should leave it alone. But if it's | meant to

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Facundo Batista
2008/1/18, Guido van Rossum [EMAIL PROTECTED]: I don't think any of that is necessary. I would rather have the following two in the language by default (see my response to Terry and Raymond): bytes is an alias for str (not even a subclass) b is an alias for +1 -- .Facundo Blog:

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-18 Thread Christian Heimes
Christian Heimes wrote: Ah, you like to keep it simple. The aliases are easily to implement. Give me twenty minutes to implement it and write some unit tests. http://bugs.python.org/issue1865 ___ Python-Dev mailing list Python-Dev@python.org

[Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Guido van Rossum
I believe the issue of whether and how to backport bytes (and bytearray?) from 3.0 to 2.6 has come up before, but I don't think we've come to any kind of conclusion. It's quite subtle. In a private email, Thomas Wouters and I discussed this: [Guido] Perhaps the biggest question in my mind is

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
[GvR] I believe the issue of whether and how to backport bytes (and bytearray?) from 3.0 to 2.6 has come up before, but I don't think we've come to any kind of conclusion. My recommendation is to leave it out of 2.6. Not every 3.0 concept has to be backported. This particular one doesn't

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Guido van Rossum
On Jan 17, 2008 6:00 PM, Raymond Hettinger [EMAIL PROTECTED] wrote: [GvR] I believe the issue of whether and how to backport bytes (and bytearray?) from 3.0 to 2.6 has come up before, but I don't think we've come to any kind of conclusion. My recommendation is to leave it out of 2.6.

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
*If* we provide some kind of backport of bytes (even if it's just an alias for or trivial subclass of str), it should be part of a strategy that makes it easier to write code that runs under 2.6 and can be automatically translated to run under 3.0 with the same semantics. If it's just an

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Guido van Rossum
On Jan 17, 2008 7:11 PM, Raymond Hettinger [EMAIL PROTECTED] wrote: *If* we provide some kind of backport of bytes (even if it's just an alias for or trivial subclass of str), it should be part of a strategy that makes it easier to write code that runs under 2.6 and can be automatically

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Stephen J. Turnbull
Raymond Hettinger writes: One other thought. I'm guessing that apps that would care about the distinction are already using unicode and are already treating text as distinct from arrays of bytes. Indeed. Mailman, for instance. Yet Mailman still has problems with (broken) wire protocol

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Terry Reedy
Guido van Rossum [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Is it reading text or binary data from stream blah? We can't tell. If | it's meant to be reading text, 2to3 should leave it alone. But if it's | meant to be reading binary data, 2to3 should change the string | literals

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Raymond Hettinger
having b and bytes as aliases for and str in 2.6 would mean that we could write 2.6 code that correctly expresses the use of binary data -- and we could use u and unicode for code using text, and 2to3 would translate those to and str and the code would be correct 3.0 text processing code.

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread glyph
On 04:43 am, [EMAIL PROTECTED] wrote: Just being able to (voluntarily! on a per-module basis!) use a different type name and literal style for data could help forward-looking programmers get started on making the distinction clear, thus getting ready for 3.0 without making the jump just yet (or

Re: [Python-Dev] What to do for bytes in 2.6?

2008-01-17 Thread Thomas Heller
Guido van Rossum schrieb: I believe the issue of whether and how to backport bytes (and bytearray?) from 3.0 to 2.6 has come up before, but I don't think we've come to any kind of conclusion. It's quite subtle. In a private email, Thomas Wouters and I discussed this: [Guido] Perhaps the