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


Groups > comp.lang.python > #43235

Re: While loop help

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'interpreter': 0.05; '(of': 0.07; 'sys': 0.07; 'subject:help': 0.08; 'seen,': 0.09; 'runs': 0.10; 'python': 0.11; '2.7.3': 0.16; 'dancing': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'invoking': 0.16; 'merely': 0.16; 'script,': 0.16; 'scripts.': 0.16; 'unlikely': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'result.': 0.19; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'putting': 0.22; 'script.': 0.24; 'why.': 0.24; 'versions': 0.24; "i've": 0.25; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'went': 0.31; 'lines': 0.31; 'that.': 0.31; '>>>>': 0.31; 'invoke': 0.31; 'option.': 0.31; 'run': 0.32; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'choosing': 0.36; "didn't": 0.36; 'two': 0.37; 'received:209': 0.37; 'being': 0.38; 'depends': 0.38; 'hat': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'extremely': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'dave': 0.60; 'most': 0.60; 'real': 0.63; 'more': 0.64; 'line,': 0.68; '1:47': 0.91; 'amongst': 0.91; 'angel': 0.91; 'banner': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=FdZKG7HzP5jnSZiUTlKRvRT5bcwkwJskKcb7NyZLMlU=; b=WVMub+tjmVDjWqm20dLXgS63AU5KgVfT4Yk+667+q++go48CONNX98WCXopYkhbKBM rFq112qsUrRhsYNCPglz2dARJfWK+6eLM2EVttL1anjpygHD4OnVo4BVVzkE423sbpHJ 5W0uELO1ljMLX1L/XcFOTXxMv1AkZpLanonllcn5hSKFadcCHy/fuIqfEAWt4kVeednV REwMtyagw4C9zBPe8LmaEGdmMEvbxezuzA8AYhPf0hGQr34gr0p/xyOvKf2zvpwGRkz1 mvtORwrsjI0k8eCeF1XNLfRfGeWAsMkePu5eWLR2Ccf8JgV5oB5SQuja6NUcaVJPGBru ySYA==
MIME-Version 1.0
X-Received by 10.58.56.161 with SMTP id b1mr21049391veq.42.1365546961114; Tue, 09 Apr 2013 15:36:01 -0700 (PDT)
In-Reply-To <kk1vga$a0c$1@news.albasani.net>
References <b93147e7-9d17-4232-99a3-767b88f9e9ba@googlegroups.com> <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> <mailman.348.1365516328.3114.python-list@python.org> <a530b25f-f9d9-45e9-925c-0ecd8a660cf6@googlegroups.com> <mailman.359.1365523839.3114.python-list@python.org> <kk1qiq$vpt$1@news.albasani.net> <mailman.385.1365538374.3114.python-list@python.org> <kk1vga$a0c$1@news.albasani.net>
Date Wed, 10 Apr 2013 08:36:00 +1000
Subject Re: While loop help
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.390.1365546964.3114.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365546964 news.xs4all.nl 2686 [2001:888:2000:d::a6]:55850
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43235

Show key headers only | View raw


On Wed, Apr 10, 2013 at 6:59 AM, Walter Hurry <walterhurry@lavabit.com> wrote:
> On Tue, 09 Apr 2013 16:12:34 -0400, Dave Angel wrote:
>
>> On 04/09/2013 03:35 PM, Walter Hurry wrote:
>>> On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
>>>
>>>> On Wed, Apr 10, 2013 at 1:47 AM,  <thomasancilleri@gmail.com> wrote:
>>>>> ... I'm not sure what version I'm using ...
>>>>
>>>> Try putting these lines into a Python script:
>>>>
>>>> import sys print(sys.version)
>>>>
>>> That works (of course), but in every Python version I've seen, one
>>> merely needs to invoke the python interactive interpreter and the
>>> banner is displayed:
>>>
>>> $ python Python 2.7.3 (default, Aug  9 2012, 17:23:57)
>>> [GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2 Type "help",
>>> "copyright", "credits" or "license" for more information.
>>>>>> quit()
>>> $
>>>
>>>
>> And if several are installed, that isn't necessarily the one that'll run
>> when one runs a script.  Depends on how the script is invoked (and on
>> what OS is running), and on the shebang line, PATH, etc.
>>
>> The real point about those two lines is that they can be added to most
>> scripts.
>
> Well yes, but if multiple versions are installed and the script has a
> shebang, then invoking the same interpreter as the shebang does will
> produce the same result.

I still went with a guaranteed-safe option. Adding those two lines to
his script is sure to report on the Python being used to run the
script, and it's not as if it's a massively-complex incantation :)

> But this is dancing on the head of a pin anyway; OP just didn't know what
> version of Python he was running, so he is extremely unlikely to have
> more than one version installed, and to be choosing amongst them.

Dunno about that. It's pretty easy to have two versions of something
without understanding why.

ChrisA

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


Thread

While loop help thomasancilleri@gmail.com - 2013-04-09 06:32 -0700
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:57 -0700
    Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:12 -0400
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 10:18 -0700
        Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:23 +1000
        Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:30 -0400
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:58 -0700
    Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:05 +1000
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
        Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:02 -0400
        Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:10 +1000
          Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
            Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:36 -0400
            Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:47 +1000
              Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
                Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:08 +1000
                Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:27 -0400
              Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
          Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
          Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 19:35 +0000
            Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 16:12 -0400
              Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 20:59 +0000
                Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 08:36 +1000
        Re: While loop help rusi <rustompmody@gmail.com> - 2013-04-10 08:59 -0700
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
  Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:00 +1000
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:49 -0700
    Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-09 23:44 -0700
      Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-10 20:00 -0700
  Re: While loop help jmfauth <wxjmfauth@gmail.com> - 2013-04-09 12:19 -0700

csiph-web