Testing for version to use from __future__ in 2.1

Fredrik Lundh fredrik at pythonware.com
Sat May 12 11:25:16 EDT 2001


Daniel Klein wrote:
> I've been testing my software using Python version 2.1 with the 'from __future__'
> statement and I'd like to be able to release it to users of both 2.1 and 2.0. So I
> thought to put something like this as the first line in the module:

maybe I'm missing something, but if you rely on nested scopes, your
program won't work under 2.0.  and if you don't use them, you don't
need the future statement.

(2.1 will warn you if your program contains code that might not work
properly with nested scopes)

> Is there anyway (short of maintaining 2 versions) to 'have my cake and eat it too',
> as this line would be the only difference betwixt versions of my software.

well, you could just leave it out...

Cheers /F





More information about the Python-list mailing list