[Web-SIG] Are you going to convert Pylons code into Python 3000?
faassen at startifact.com
Wed Mar 5 09:40:23 CET 2008
On Wed, Mar 5, 2008 at 3:25 AM, Guido van Rossum <guido at python.org> wrote:
> On Tue, Mar 4, 2008 at 6:13 PM, Martijn Faassen <faassen at startifact.com> wrote:
> > Hey,
> > On Wed, Mar 5, 2008 at 1:48 AM, Graham Dumpleton
> > <graham.dumpleton at gmail.com> wrote:
> > [snip]
> > > In the case of code which directly talks to the interface defined by
> > > WSGI specification I very much doubt the py2to3 script will help. This
> > > is because for WSGI to work with Python 3.0 there needs to be a change
> > > from use of string type objects to byte string type objects. I would
> > > suspect that py2to3 is only get help in any sort of automated way with
> > > the fact that a string object becomes unicode aware, not where with
> > > WSGI the code would have to change to use and deal with a different
> > > type of object completely. The implications of this change to a byte
> > > string type object are going to be much more complicated.
> > I have no idea what the capabilities of this script are. I would
> > *imagine* it would convert classic strings into the bytes types, and
> > unicode strings into the new string type.
> It does nothing of the kind. It leaves 'xxx' literals alone and
> translates u'xxx' to 'xxx'. That's because (in many apps) both are
> used primarily for text.
> BTW I suggest that you play with it at least a little bit (run it on
> its own example.py file) before diving into this discussion...
I accurately described my lack of knowledge of the script, then. :)
Sure, I need to play with the script. I guess the best route would be
to introduce bytes in your code in Python 2.x and have the script
leave that alone. If WSGI 2.0 then makes it into Python 2.x as well,
then there's no problem with API breakage.
Playing with the script will happen sometime, but I think it's quite
clear the script will be of no help if important library APIs also
break down because people take their chances during transition (and
the script doesn't take care of it, which it can't for third party
WSGI is probably not the best example given the string issue and its
inclusion in the Python core, though: as Graham expressed, it's
probably going to have problems no matter what. I also think any new
version could be developed on Python 2.6 first, as this will support
the bytes type as far as I understand. And yes, I need to try the
Python 2.6 alpha interpreter first too. :)
More information about the Web-SIG