Re: [Python-Dev] The bytes type
On 06:49 pm, python@rcn.com wrote:
I think we should draw a line in the sand and resolve not to garbage-up Py2.6. The whole Py3.0 project is about eliminating cruft and being free of the bonds of backwards compatibility. Adding non-essential cruft to Py2.6 goes against that philosophy.
Emotionally charged like "cruft" and "garbage" are obscuring the issue. Let's replace them with equivalents charged in the opposite direction: "I think we should draw a line in the sand and resolve not to compatibility-up Py2.6. The whole Py3.0 project is about eliminating useful libraries and being free of the bonds of working software. Adding non-essential forward-compatibility to Py2.6 goes against that philosophy." The benefit (to me, and to many others) of 3.x over 2.x is the promise of more future maintenance, not the lack of cruft. In fact, if I made a list of my current top ten problems with Python, "cruft" wouldn't even make it in. There is lots of useful software that will not work in the 3.0 series, and without forward compatibility there is no way to get there from here. As Guido said, if 3.0 is going to break compatibility, that burdens the 2.x series with the need to provide transitional functionality. The upgrade path needs to be available in one version or the other, or 2.x needs to be maintained forever. You can't have it both ways.
glyph> "I think we should draw a line in the sand and resolve not to glyph> compatibility-up Py2.6. The whole Py3.0 project is about glyph> eliminating useful libraries and being free of the bonds of glyph> working software. Adding non-essential forward-compatibility to glyph> Py2.6 goes against that philosophy." I think you meant "useless", right? I'm not aware of any proposals to eliminate the os, re or csv modules. ;-) Skip
On 1/12/07, glyph@divmod.com
On 06:49 pm, python@rcn.com wrote:
I think we should draw a line in the sand and resolve not to garbage-up Py2.6. The whole Py3.0 project is about eliminating cruft and being free of the bonds of backwards compatibility. Adding non-essential cruft to Py2.6 goes against that philosophy.
Emotionally charged like "cruft" and "garbage" are obscuring the issue.
Let's replace them with equivalents charged in the opposite direction:
"I think we should draw a line in the sand and resolve not to compatibility-up Py2.6. The whole Py3.0 project is about eliminating useful libraries and being free of the bonds of working software. Adding non-essential forward-compatibility to Py2.6 goes against that philosophy."
Well put. Not that I agree.
The benefit (to me, and to many others) of 3.x over 2.x is the promise of more future maintenance, not the lack of cruft.
The benefit (to me, and to many others) of 3.x over 2.x is the promise
of getting rid of cruft.
If we're going to re-add cruft for the sake of temporary
compatibility, we may as well just stick with 2.x. You have to take a
quantum leap sometimes or you end up working around the same old
mistakes.
For instance, getting rid of the str/unicode dichotomy would be a
wonderful thing. Then if I make a subclass of string I don't have to
think "str or unicode? or two parallel classes?" It'll also eliminate
the possibility of a stray 8-bit string containing non-ASCII
characters from making your program go kablooie UnicodeDecodeError
when it's in a "%" or ".join()", or at least localize the problem to
ONE place (the string constructor) where it'll be in every
programmer's face and they'll all hopefully learn to handle it
consistently and not pass bad strings to other packages.
Getting rid of old-style classes would be nice too.
--
Mike Orr
On 1/12/07, Mike Orr
On 1/12/07, glyph@divmod.com
wrote: The benefit (to me, and to many others) of 3.x over 2.x is the promise of more future maintenance, not the lack of cruft.
The benefit (to me, and to many others) of 3.x over 2.x is the promise of getting rid of cruft.
If we're going to re-add cruft for the sake of temporary
compatibility, we may as well just stick with 2.x. You have to take a quantum leap sometimes or you end up working around the same old mistakes.
There seems to be rather a lot of confusion. No one is suggesting
Python 3.0be anything less for the sake of backward compatibility.
Instead, it has
been suggested Python 2.6 (and possibly 2.7) be something *more* in order to
provide for an easier upgrade path. No compromises in Python 3.0.
--
Thomas Wouters
On Jan 15, 2007, at 8:02 AM, Thomas Wouters wrote:
The benefit (to me, and to many others) of 3.x over 2.x is the promise of getting rid of cruft. If we're going to re-add cruft for the sake of temporary compatibility, we may as well just stick with 2.x. You have to take a quantum leap sometimes or you end up working around the same old mistakes.
There seems to be rather a lot of confusion. No one is suggesting Python 3.0 be anything less for the sake of backward compatibility. Instead, it has been suggested Python 2.6 (and possibly 2.7) be something *more* in order to provide for an easier upgrade path. No compromises in Python 3.0.
True: nobody is suggesting python 3.0 be anything less. But, I am indeed suggesting that Python 3.0 be something *more*: I am suggesting that people keep in mind the ease of writing of a program which can run on both 2.5 and 3.0. And wherever possible, act so as to preserve that ease. That may indeed involve a "compromise" in 3.0. Given that Python 3.0 is supposed to be released in ~ 1.5 years (I guess), around the same time as the 2.6 release, I do think 3.0 ought to have a compatibility story that doesn't depend on 2.6. My goal here is not to get Py3.0 to be backwards compatible, it's to get the intersection of 2.5 and 3.0 to be large enough that I can explicitly write code to that intersection without having to tear my hair out and make the code incredibly gross (or worse yet, not be able to do it at all). See previous iteritems() example. I really don't see why there's such an urgency for removing things IMMEDIATELY in Python 3 that don't have a suitable replacement in an already released version. There's plenty to remove which already does have a suitable replacement. I think the major cruft all falls into this category (unicode strings already exist, newstyle classes already exist, non-string exceptions already exist. The 'bytes' type doesn't exist yet, but I expect can be introduced in such a way that it has a useful intersection of functionality with the current method of using 'str' to hold bytes.) I'd like to remind everyone that 3.0 won't be the last version of python ever released (at least, I hope!). Where Py 3.0 introduces a brand-new way to do something, the old can be removed at a future date. Mark it as deprecated, so that nobody will use it in new code, and remove it a few more versions down the line. Getting rid of cruft is great...but you can't properly call something "cruft" when it's the only way. Allowances for writing portable code could make a big difference in speed of adoption. I expect Python 3.0 will be a "quantum leap", even if people don't have to rewrite everything from scratch or fork their codebases to keep compatibility with both releases. There's plenty to look forward to, and I'd love to actually be able to actually use it. But I need to be able to run 3rd party libraries, and the 3rd party libraries must still remain compatible with earlier releases. If those requirements are incompatible with using Py 3.0, it'll be a shame. James
On 1/16/07, James Y Knight
On Jan 15, 2007, at 8:02 AM, Thomas Wouters wrote:
There seems to be rather a lot of confusion. No one is suggesting Python 3.0 be anything less for the sake of backward compatibility. Instead, it has been suggested Python 2.6 (and possibly 2.7) be something *more* in order to provide for an easier upgrade path. No compromises in Python 3.0.
True: nobody is suggesting python 3.0 be anything less. But, I am indeed suggesting that Python 3.0 be something *more*: I am suggesting that people keep in mind the ease of writing of a program which can run on both 2.5 and 3.0. And wherever possible, act so as to preserve that ease. That may indeed involve a "compromise" in 3.0.
I'm not keen on compromises in 3.0, but without specific proposals I don't see why we're arguing. So, please, what specific thing(s) are you proposing we do in 3.0? Please make a list of specifics rather than attempting at specifying a general rule to match things that could go into the list; you've tried the latter and I still don't know what you want. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
On Jan 16, 2007, at 10:47 AM, Guido van Rossum wrote:
I'm not keen on compromises in 3.0, but without specific proposals I don't see why we're arguing. So, please, what specific thing(s) are you proposing we do in 3.0? Please make a list of specifics rather than attempting at specifying a general rule to match things that could go into the list; you've tried the latter and I still don't know what you want.
I can't come up with a full list, as I don't know everything that's changed or is being planned to change. But here's some stuff I do know about: 1) don't remove dict.iteritems, dict.itervalues, dict.iterkeys 2) For the bytes type, keep enough of an overlap with the current use of str-as-raw-bytes that common operations work with either one (so that I can, f.e. read from a socket or a file and process that data). Without seeing the details for how bytes is going to be implemented, it's hard to say exactly what this means. 3) Preferably continue to allow old syntax when adding new syntax (e.g. exception catching syntax). Alternatively, a completely reliable automated conversion script to convert the syntax would also be acceptable if not quite as convenient. Mainly I'd just like to see "allowing the ability to write code which is portable between 2.5 and 3.0" as an explicit goal of the python 3.0 release. I trust that if the developers agree upon that as being a goal, the right things would happen, whatever they may be for the specific change in question. James
On 1/16/07, James Y Knight
On Jan 16, 2007, at 10:47 AM, Guido van Rossum wrote:
I'm not keen on compromises in 3.0, but without specific proposals I don't see why we're arguing. So, please, what specific thing(s) are you proposing we do in 3.0? Please make a list of specifics rather than attempting at specifying a general rule to match things that could go into the list; you've tried the latter and I still don't know what you want.
I can't come up with a full list, as I don't know everything that's changed or is being planned to change. But here's some stuff I do know about:
1) don't remove dict.iteritems, dict.itervalues, dict.iterkeys 2) For the bytes type, keep enough of an overlap with the current use of str-as-raw-bytes that common operations work with either one (so that I can, f.e. read from a socket or a file and process that data). Without seeing the details for how bytes is going to be implemented, it's hard to say exactly what this means. 3) Preferably continue to allow old syntax when adding new syntax (e.g. exception catching syntax). Alternatively, a completely reliable automated conversion script to convert the syntax would also be acceptable if not quite as convenient.
Mainly I'd just like to see "allowing the ability to write code which is portable between 2.5 and 3.0" as an explicit goal of the python 3.0 release.
Actually, you missed the part where that is explicitly *not* the goal of
Python 3.0. The main goal of Python 3.0 is explicitly to *break* the things
you don't want broken. If you really not want them broken, Python 3.0 is a
non-starter for you. You can basically stop worrying about it, and just
never switch any of your Python 2.5 projects to Python 3.0. If you want to
talk about an upgrade-path, you will have to accept that it means waiting
for Python 2.6, and also that it means not using some features that will be
removed, like the iter* methods of dicts. We (or at least some of us ;-)
will do our best to provide a viable upgrade path from 2.6 even for
complicated cases like the changing dict methods, but an upgrade path
directly from 2.5-or-earlier to 3.0 is just plain impossible; you would have
to change your code to avoid the things that will change in Python 3.0,
which may lead to inefficient or complicated code.
Python 3.0 is there to break backward compatibility, and do it cleanly. Any
work done to ease the upgrade path should be done in 2.x (and separate
tools), not 3.0. 3.0 is not a transitional release.
--
Thomas Wouters
On 1/16/07, James Y Knight
On Jan 16, 2007, at 10:47 AM, Guido van Rossum wrote:
I'm not keen on compromises in 3.0, but without specific proposals I don't see why we're arguing. So, please, what specific thing(s) are you proposing we do in 3.0? Please make a list of specifics rather than attempting at specifying a general rule to match things that could go into the list; you've tried the latter and I still don't know what you want.
I can't come up with a full list, as I don't know everything that's changed or is being planned to change. But here's some stuff I do know about:
1) don't remove dict.iteritems, dict.itervalues, dict.iterkeys 2) For the bytes type, keep enough of an overlap with the current use of str-as-raw-bytes that common operations work with either one (so that I can, f.e. read from a socket or a file and process that data). Without seeing the details for how bytes is going to be implemented, it's hard to say exactly what this means. 3) Preferably continue to allow old syntax when adding new syntax (e.g. exception catching syntax). Alternatively, a completely reliable automated conversion script to convert the syntax would also be acceptable if not quite as convenient.
Mainly I'd just like to see "allowing the ability to write code which is portable between 2.5 and 3.0" as an explicit goal of the python 3.0 release. I trust that if the developers agree upon that as being a goal, the right things would happen, whatever they may be for the specific change in question.
Well, there's the crux. That is an explicit NON-goal. It always has been. It would add tons of constraints to Python 3000, and the net effect would be that everybody would continue to code in the 2.5 dialect, making the intended cleanup of the language ineffective. We are planning various other ways of providing conversion help. The most promising at this point is to make the following an explicit goal of Python 2.6 and Python 3000: make it possible to write code that runs under 2.6, and that, after automatic conversion using the 2to3 refactoring tool (see sandbox/2to3), runs under 3.0, *without* requiring manual patching up of the output of the refactoring tool. The latter clause makes it easy (if not trivial) for developers to maintain parallel versions. All you need is a sufficiently good test suite, so that you can automatically verify that the conversion result actually works as intended under 3.0. Since you'd have to do that testing anyway, there is not much of an added effort except for maintaining separate tarballs. There are still certain things you can't do, because the conversion tool doesn't handle them well (e.g. don't use variables named 'long' and don't create classes with methods named 'keys'); but I expect that the subset of 2.6 that you can use will be much larger using this approach than what you would get using the identical-source approach you are supporting. Oh, and the same approach will also work (with only a few more constraints) for 2.5 and even earlier versions. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
On Jan 16, 2007, at 2:35 PM, Guido van Rossum wrote:
Mainly I'd just like to see "allowing the ability to write code which is portable between 2.5 and 3.0" as an explicit goal of the python 3.0 release. I trust that if the developers agree upon that as being a goal, the right things would happen, whatever they may be for the specific change in question.
Well, there's the crux. That is an explicit NON-goal. It always has been. It would add tons of constraints to Python 3000, and the net effect would be that everybody would continue to code in the 2.5 dialect, making the intended cleanup of the language ineffective.
Okay. I think this is a mistake. Everyone will continue to code in a 2.5-compatible dialect for the immediate future, because their code needs to continue to function in 2.5. As I keep pointing out, the language cleanup doesn't have to be all at once: remove all the already-replaced features now, and deprecate a bunch more things for removal a few releases later. That'd allow transition to 3.0 to occur during the time when people have to write in a 2.5-compatible dialect, anyhow. Otherwise, they'll be writing to 2.5-ONLY that won't run on 3.0 at all.
We are planning various other ways of providing conversion help. The most promising at this point is to make the following an explicit goal of Python 2.6 and Python 3000: make it possible to write code that runs under 2.6, and that, after automatic conversion using the 2to3 refactoring tool (see sandbox/2to3), runs under 3.0, *without* requiring manual patching up of the output of the refactoring tool.
Given that my ideal is not going to happen, I guess I'll have to be content with this. It WILL allow code to be converted incrementally to be compatible with Python 3.X (which is very important!), but, unfortunately, not for many years after Py3.0's release. (since the code can't be made portable until Python 2.6 has been out long enough for that to become a reasonable minimum requirement). But, a delayed migration strategy is certainly much much better than *no* migration strategy, so it's not all doom and gloom. But, anyhow, that's enough from me. My opinion has been made known, and disagreed with by (I think) all the prominent python developers. So now, I'll let it drop and go get some work done. Thanks for listening, James
"James Y Knight"
participants (7)
-
glyph@divmod.com
-
Guido van Rossum
-
James Y Knight
-
Mike Orr
-
skip@pobox.com
-
Terry Reedy
-
Thomas Wouters