Testing for version to use from __future__ in 2.1

Emile van Sebille emile at fenx.com
Sat May 12 11:33:57 EDT 2001


I think the point is that nested scopes can (potentially) break existing
code.  Existing applications should be tested to see if they break.  To do
so, you add from __future__ import nested_scopes to your code base.  Now,
you've broken your code base so it will no longer run under 1.52, 2.0 etc.
If you could try/except around the import you could maintain a single code
base.

All this assumes you don't take advantage of other 2.0+ features, but
certainly for some people, keeping the code backward compatible to 1.52 so
that it runs on systems through 2.2 is necessary.  At the moment, I don't
see a way to do this.

--

Emile van Sebille
emile at fenx.com

---------
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:wBcL6.1691$Yu6.419701 at newsc.telia.net...
> 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