On 04/12/2011 08:34 AM, Tobias Hoppe wrote:
> I've read the status page for py3k and stumbled upon the cleanup tasks,
> especially the version checks. I agree that calling sys.version_info[0] is not a
> smart choice.
>
> Why not use a new variable in __init__.py, something like a boolean __is_py3k__.
> Every module which needs a choice between py2.x and 3.x can simply:
>
> from matplotlib import __is_py3k__
>
> and use:
>
> if __is_py3k__:
>
>
It can't live in __init__.py without creating cyclical imports.
(__init__.py includes most everything else). I think the solution,
though not ideal either, is to create a new module called "compat" or
some such that contains this and possibly other python2/python3
compatibility code.
Cheers,
Mike
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
|