[pypy-dev] access to pypy version info, internals
Armin Rigo
arigo at tunes.org
Thu May 27 11:52:20 CEST 2010
Hi Holger,
On Mon, May 17, 2010 at 11:38:47AM +0200, holger krekel wrote:
> What about rather doing a single clean 'sys.pypy' module namespace such
> that we can do:
>
> a) hasattr(sys, 'pypy')
> b) sys.pypy.version_info >= (x,y)
> c) expose the __pypy__ builtin module as sys.pypy?
>
> Semantically, the sys module already presents an interaction
> API with the interpreter. Doing a single namespace looks more
> elegant to me than of cluttering sys with an artifical 'pypy_*'
> prefixed namespace and having to (try-except)import __pypy__.
You don't have to put the "import __pypy__" in a try-except, if you
already checked that "__pypy__" in sys.builtin_module_names. But your
solution looks clean, and the point a) becomes shorter too :-)
I would like to avoid having the semi-internal interface of PyPy change
nearly as much as, say, the one from the py lib one (and I'm not
exagerating there: there are *6* different versions of "try: from
py.internal.stuff import x" in my own conftest.py :-) . That said, your
suggestion seems nice enough. Comments from others?
A bientot,
Armin.
More information about the Pypy-dev
mailing list