Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95144

Re: Which Python implementation am I using?

From Laura Creighton <lac@openend.se>
Subject Re: Which Python implementation am I using?
References <55c4ea68$0$1667$c3e8da3$5496439d@news.astraweb.com>
Date 2015-08-08 01:03 +0200
Newsgroups comp.lang.python
Message-ID <mailman.1316.1438988626.3674.python-list@python.org> (permalink)

Show all headers | View raw


In a message of Sat, 08 Aug 2015 03:27:04 +1000, "Steven D'Aprano" writes:
>
>    def jython():
>        t = platform.java_ver()
>        return (t and t[0]) or ('java' in sys.platform.lower())

Around here if we cannot find platform.python_implemention()
we just look for sys.platform.startswith('java')

Are there any cases where you need platform.java_ver() ?

I don't know about IronPython

>How about PyPy, Stackless, or others?

PyPy has platform.python_implementation these days as well.  If you
cannot find it, look for '__pypy__' in sys.builtin_module_names

For detecting Stackless my PYTHONSTARTUP just tries to import stackless.

Detecting Cygwin may be important for you.  It's a real mess.
platform.system usually gives you stuff like: CYGWIN_NT-5.1
but, alas, sometimes it just gives you 'Windows'.
os.name sometimes gives you 'nt' -- but sometimes it gives you 'posix'.

I've played whack-a-mole with this one for a while, and still don't
like any of our solutions.  And the customer threw out his windows
systems and replaced them with Macs, so the problem now is moot for me.

Laura

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Which Python implementation am I using? Steven D'Aprano <steve@pearwood.info> - 2015-08-08 03:27 +1000
  Re: Which Python implementation am I using? Ned Batchelder <ned@nedbatchelder.com> - 2015-08-07 11:16 -0700
  Re: Which Python implementation am I using? Laura Creighton <lac@openend.se> - 2015-08-08 01:03 +0200

csiph-web