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


Groups > comp.lang.python > #93016

Re: How to check in script if Python or Jython is used

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; 'paths': 0.05; '21,': 0.07; 'present,': 0.07; 'subject:How': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'cc:name:python list': 0.16; 'imo,': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'os,': 0.22; 'am,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'installed': 0.26; 'message-id:@mail.gmail.com': 0.28; 'url:mailman': 0.31; 'run': 0.32; 'probably': 0.32; 'url:python': 0.33; 'usually': 0.33; 'received:google.com': 0.34; 'url:listinfo': 0.35; 'could': 0.35; 'execution': 0.35; 'list': 0.35; 'url:org': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'difference': 0.38; 'test': 0.39; 'senior': 0.39; 'build': 0.40; 'determine': 0.61; 'different': 0.64; 'between': 0.65; 'differences': 0.66; 'cecil': 0.84; 'subject:check': 0.84; 'taken.': 0.84; 'url:cecilwesterhof': 0.84; 'westerhof': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=viy0+m06inBKDmZiNQ4gYcvmHsO89zDCbojQi/lR7IQ=; b=Iv2tgAa+a90oq6pKo75Z/qNRkn6BCEiW6MasT2aOiZkzNpSo3bUjUb35kCQawA9McB UsfUXhASmBjNGpc228XrMA/JID4HksjG+ixkwQVsEd9GmeMhu8OQvgX+lpwt/BIBHBS1 TYUbUOASSb6MmP3/5n0Z30jmByfQ3EenQRnF9lyOapM2STfEFa1a85XJlw5GMh32EAW+ d+91l3P2D9WJdk3YsAVxPYQMgNqpVGJ4CMqwIgRWeJyQc2Gl32CqteQy99VGtp1vhXZR tzLkIwmTF/k2NXYuTLtNatE12WrMu21UgxPmit+0RiHkwWtf3IYALDliCmuoAMEV/yEb f4+A==
MIME-Version 1.0
X-Received by 10.140.42.105 with SMTP id b96mr40022365qga.105.1435001949701; Mon, 22 Jun 2015 12:39:09 -0700 (PDT)
In-Reply-To <87r3p5pjjd.fsf@Equus.decebal.nl>
References <87r3p5pjjd.fsf@Equus.decebal.nl>
Date Mon, 22 Jun 2015 12:39:09 -0700
Subject Re: How to check in script if Python or Jython is used
From Dan Stromberg <drsalists@gmail.com>
To Cecil Westerhof <Cecil@decebal.nl>
Cc Python List <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.711.1435001958.13271.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435001958 news.xs4all.nl 2900 [2001:888:2000:d::a6]:41541
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93016

Show key headers only | View raw


IMO, it's usually better to test for features and use them if they are
present, than to build a list of features available in specific
interpreters.

I see it as analogous to the difference between huge C #ifdef's on OS,
and autoconf.

On Sun, Jun 21, 2015 at 1:12 AM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> I installed Jython and will start playing with it. There probably will
> be differences between Python and Jython. Is there a way to determine
> if a script is run by Python or Jython? Then different execution paths
> could be taken. With sys.version(_info) you do not get this
> information.
>
> --
> Cecil Westerhof
> Senior Software Engineer
> LinkedIn: http://www.linkedin.com/in/cecilwesterhof
> --
> https://mail.python.org/mailman/listinfo/python-list

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


Thread

How to check in script if Python or Jython is used Cecil Westerhof <Cecil@decebal.nl> - 2015-06-21 10:12 +0200
  Re: How to check in script if Python or Jython is used Laura Creighton <lac@openend.se> - 2015-06-21 11:22 +0200
    Re: How to check in script if Python or Jython is used Cecil Westerhof <Cecil@decebal.nl> - 2015-06-21 12:24 +0200
  Re: How to check in script if Python or Jython is used Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-21 18:12 +0200
  Re: How to check in script if Python or Jython is used Dan Stromberg <drsalists@gmail.com> - 2015-06-22 12:39 -0700

csiph-web