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


Groups > comp.lang.python > #95144

Re: Which Python implementation am I using?

Path csiph.com!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lac@openend.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'tries': 0.05; 'pypy': 0.07; 'cc:addr:python-list': 0.09; 'os.name': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'stackless': 0.09; 'subject:using': 0.09; 'def': 0.13; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'ironpython': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'threw': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'laura': 0.18; 'windows': 0.20; '2015': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'cc:2**1': 0.22; 'subject:skip:i 10': 0.22; 'sat,': 0.23; 'import': 0.24; 'header :In-Reply-To:1': 0.24; "i've": 0.25; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'solutions.': 0.30; 'skip:s 30': 0.31; 'problem': 0.33; 'usually': 0.33; 'gives': 0.35; 'replaced': 0.35; 'skip:p 30': 0.35; 'sometimes': 0.35; 'but': 0.36; 'there': 0.36; 'cases': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'charset:us- ascii': 0.37; 'stuff': 0.38; 'well.': 0.40; 'where': 0.40; 'still': 0.40; 'header:Message-Id:1': 0.61; 'customer': 0.62; 'real': 0.62; 'our': 0.64; 'you.': 0.64; 'here': 0.66; 'received:89': 0.80; '+1000,': 0.84; '>how': 0.84; 'detecting': 0.84; 'macs,': 0.84; 'moot': 0.84; 'played': 0.91
To "Steven D'Aprano" <steve@pearwood.info>
cc python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: Which Python implementation am I using?
In-Reply-To Message from "Steven D'Aprano" <steve@pearwood.info> of "Sat, 08 Aug 2015 03:27:04 +1000." <55c4ea68$0$1667$c3e8da3$5496439d@news.astraweb.com>
References <55c4ea68$0$1667$c3e8da3$5496439d@news.astraweb.com>
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <9764.1438988599.1@fido>
Date Sat, 08 Aug 2015 01:03:19 +0200
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Sat, 08 Aug 2015 01:03:27 +0200 (CEST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1316.1438988626.3674.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1438988626 news.xs4all.nl 2894 [2001:888:2000:d::a6]:52800
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95144

Show key headers only | 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