[Web-SIG] My experiences implement WSGI on java/j2ee/jython.

Ian Bicking ianb at colorstudy.com
Mon Aug 30 05:33:35 CEST 2004

Phillip J. Eby wrote:
> How about we just add a "Using WSGI with earlier Python Versions" 
> subsection to the application/implementation notes?
> It would simply note that a WSGI server/gateway intended to work pre-2.2 
> *must* use only a 'for' loop to iterate over an iterable returned by the 
> application, and that applications needing to work pre-2.2 would have to 
> implement the old-style iteration protocol.

This would mean that applications would have to be written with backward 
compatibility in mind.  Which may not be terribly unreasonable.  But I 
don't see any reasonable way you can write version-neutral code.

For instance, file objects are not iterable in older Pythons, so you 
can't return those.  That's pretty annoying.  And there's no method that 
is invoked which warns you that you need to be backward-compatible -- 
__iter__ is called on newer Pythons, but nothing on newer ones.

Of course, those same functions I put in the other email could be 
applied on the application side, maybe conditionally depending on Python 

 From a practical sense, though, I suspect servers are going to be more 
aware of their target Python version than applications.  So server 
authors are going to have more incentive to write the code to deal with 
older Python versions.

Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org

More information about the Web-SIG mailing list