[Web-SIG] WSGI and Py3k

Dmitry Vasiliev dima at hlabs.spb.ru
Tue Dec 23 22:56:46 CET 2008


Hi!

Currently wsgiref package in Py3k just broken so I've filled ticket
#4718 (http://bugs.python.org/issue4718). Actually there are more than
one ticket about the problem - see the link for details. In a comment to
the ticket Phillip said we need to open discussion here then update
PEP-333 and only then fix the package. I think it's important to fix
wsgiref *somehow* (for example we can temporarily disable it) in the
upcoming Python 3.0.1 release so there is the main question:

- Which Py3k data type to use as "strings" mentioned in the PEP?

For now the PEP explicitly say to *always* use "str" type
(http://www.python.org/dev/peps/pep-0333/#unicode-issues) but in Py3k
"str" is just like "unicode" in Python 2.*. Moreover from Py3k's point
of view there is a conflict in the PEP because of 'strings must be of
type str, and must not be of type unicode'.

The type corresponding to "str" from Python 2.* in Py3k is "bytes" so at
first it seems convenient to use "bytes". But it violates the current
version of the PEP and 2to3 utility (for now?) convert old "str" as new
"str", not "bytes". However I believe it's not too hard to encode new
"str" (converted by 2to3) to "bytes" before returning from an WSGI
application.

Also we can support both new "str" and "bytes" in some transitional period.

-- 
Dmitry Vasiliev <dima at hlabs.spb.ru>
http://hlabs.spb.ru


More information about the Web-SIG mailing list