Re: [Web-SIG] Are you going to convert Pylons code into Python 3000?

2008-03-05 Thread Martijn Faassen
Hey,

On Wed, Mar 5, 2008 at 3:25 AM, Guido van Rossum [EMAIL PROTECTED] wrote:
 On Tue, Mar 4, 2008 at 6:13 PM, Martijn Faassen [EMAIL PROTECTED] wrote:
   Hey,
  
On Wed, Mar 5, 2008 at 1:48 AM, Graham Dumpleton
[EMAIL PROTECTED] 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
APIs).

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. :)

Regards,

Martijn
___
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com


Re: [Web-SIG] Are you going to convert Pylons code into Python 3000?

2008-03-04 Thread Graham Dumpleton
Jose Galvez wrote:
 this is an interesting issue, because I would suspect that all our pylons
 applications will have to be converted as well as the pylons base code.  I
 know that there is going to be a program which will automate the
 translation, but not having used it I don't know what issues the translation
 will cause.  The other big question is will eggs will they  be able to tell
 the difference between python 2.x and 3.x since the code will be different
 Jose

 On Tue, Mar 4, 2008 at 3:17 AM, Leo [EMAIL PROTECTED] wrote:

 
  Subj.
  Is Python 3000 migration planned?

There is more to it than just that. One problem is that the WSGI 1.0
specification is incompatible with Python 3.0. There were some
preliminary discussions about how the specification would need to be
changed, but no real final outcome. The discussions also probably
didn't cover everything that would need to be changed in the
specification. For example, wsgi.file_wrapper and how it would have to
be changed wasn't discussed.

The main issues were captured in:

  http://www.wsgi.org/wsgi/Amendments_1.0

Note though that that page is merely a collection of points discussed
and is itself not any sort of official set of amendments to the WSGI
specification.

Personally I believe that WSGI 1.0 should die along with Python 2.X. I
believe that WSGI 2.0 should be developed to replace it and the
introduction of Python 3.0 would be a great time to do that given that
people are going to have to change their code anyway and that code
isn't then likely to be backward compatible with Python 2.X.

Graham
___
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com


Re: [Web-SIG] Are you going to convert Pylons code into Python 3000?

2008-03-04 Thread Ian Bicking
Graham Dumpleton wrote:
 Personally I believe that WSGI 1.0 should die along with Python 2.X. I
 believe that WSGI 2.0 should be developed to replace it and the
 introduction of Python 3.0 would be a great time to do that given that
 people are going to have to change their code anyway and that code
 isn't then likely to be backward compatible with Python 2.X.

I don't believe it should just *die*.  But I agree that this is a good 
time to revisit the specification.  Especially since I have no idea how 
the change to unicode text would effect the WSGI environment.  Having 
the environment hold bytes seems weird, but having it hold unicode is a 
substantial change.

I don't think it will be as bad as Martijn thinks, because the libraries 
people use will probably have relatively few interface changes.  Pylons 
and WebOb for instance should maintain largely the same interface (and 
they already expose unicode when possible).  None of the changes 
proposed for WSGI 2 would change this.

If I'm maintaining two versions of a library (one for Python 2, one for 
Python 3), then at least I'd like to get a little benefit out of it, and 
a revised WSGI would give some benefit.

I think we might still need some kind of WSGI 1.1 to clarify what WSGI 1 
(-like semantics) means in a Python 3.0 environment.  Creating adapters 
from WSGI 1 to WSGI 2 should be easy enough that we could still offer 
some support for minimally-translated WSGI code.

   Ian
___
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com