backward/forward compatibility in PYTHON?

holger krekel pyth at devel.trillke.net
Fri May 31 13:21:34 EDT 2002


Lulu of the Lotus-Eaters wrote:
> holger krekel <pyth at devel.trillke.net> wrote previously:
> |- if you know you are using e.g. python2.2 features you might
> |  want to code a one-line assertion like
> |
> |    asssert(sys.version_info[:2]>=(2,2))
> 
>     >>> import sys
>     >>> assert(sys.version_info[:2]>=(2,2))
>     Traceback (innermost last):
>       File "<stdin>", line 1, in ?
>     AttributeError: version_info
> 
> Of course, it *does* work in Python 2.2 :-).

of course :-) just for completeness: one has
to fiddle with the 'sys.version' - string 
to get sane behaviour from 1.5.2 onwards.

    holger





More information about the Python-list mailing list