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


Groups > comp.lang.python > #69609

Re: Two Questions about Python on Windows

Date 2014-04-03 11:00 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Two Questions about Python on Windows
References <lhk4el$91k$1@news.albasani.net> <CALwzidmpCpLrR=0J+D1isKW_9kGeE=UyM3Q_wqm7xitHeRSCfg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8854.1396554748.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 04/03/2014 10:54 AM, Ian Kelly wrote:
> On Apr 3, 2014 11:12 AM, "Walter Hurry" wrote:
>>
>> Secondly, on *ix, if there's an up-to-date .pyc in the right place and I run foo.py, Python will automagically use foo.pyc.
>
> I don't believe this is exactly correct. Python will only use a .pyc automatically for imported modules. For a file
> specified on the command line, Python won't try to second-guess the user as to which file they want.  The file could
> have a .php extension, and Python will happily run it if the contents are valid Python code.

Right.  When specifying the file as a command-line argument to python, you have it include the extension, and that is 
exactly the file that python executes.  Also, using this method, a .pyc file is not created.  Only imported files may 
have a .py[co] file automatically created for corresponding .py file.

--
~Ethan~

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


Thread

Two Questions about Python on Windows Walter Hurry <walterhurry@gmail.com> - 2014-04-03 17:06 +0000
  Re: Two Questions about Python on Windows maxerickson@gmail.com - 2014-04-03 10:31 -0700
    Re: Two Questions about Python on Windows Tim Roberts <timr@probo.com> - 2014-04-05 14:57 -0700
  Re: Two Questions about Python on Windows Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-03 11:54 -0600
  Re: Two Questions about Python on Windows Terry Reedy <tjreedy@udel.edu> - 2014-04-03 14:34 -0400
  Re: Two Questions about Python on Windows Ethan Furman <ethan@stoneleaf.us> - 2014-04-03 11:00 -0700
  Re: Two Questions about Python on Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-03 21:15 +0100
  Re: Two Questions about Python on Windows Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-03 16:41 -0600
  Re: Two Questions about Python on Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-03 23:57 +0100

csiph-web