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


Groups > comp.lang.python > #71856

Re: All-numeric script names and import

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail
From Mark H Harris <harrismh777@gmail.com>
Newsgroups comp.lang.python
Subject Re: All-numeric script names and import
Date Wed, 21 May 2014 09:24:30 -0500
Organization Aioe.org NNTP Server
Lines 32
Message-ID <537CB71E.5060506@gmail.com> (permalink)
References <mailman.10190.1400680014.18130.python-list@python.org>
NNTP-Posting-Host eSF12mcVRIwL+eMIMJ03mA.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.python:71856

Show key headers only | View raw


On 5/21/14 8:46 AM, Chris Angelico wrote:
> # from 1 import app as application # Doesn't work with a numeric name
> application = __import__("1").app
>
> Is there a way to tell Python that, syntactically, this thing that
> looks like a number is really a name? Or am I just being dumb?
>
> (Don't hold back on that last question. "Yes" is a perfectly
> acceptable answer. But please explain which of the several
> possibilities is the way I'm being dumb. Thanks!)

If you have a script that is self-programming (producing sequenced, 
numbered scripts 1.py 2.py 3.py) then why not just prefix an alpha 
character  a1.py a2.py a3.py ?

Otherwise, are you just pulling our chain?    :)


On the other hand, if you open IDLE and then open the 1.py module (yes, 
that's a dumb name) and then click run--> run module it will import and 
run...  assuming  1.py  contains some valid python code.


Why must you have a numbered script?



You're just pulling someone's chain, right?



marcus

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


Thread

All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-21 23:46 +1000
  Re: All-numeric script names and import Mark H Harris <harrismh777@gmail.com> - 2014-05-21 09:24 -0500
    Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-22 00:40 +1000
  Re: All-numeric script names and import Mark H Harris <harrismh777@gmail.com> - 2014-05-21 09:24 -0500
  Re: All-numeric script names and import Rustom Mody <rustompmody@gmail.com> - 2014-05-22 19:08 -0700
    Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 13:26 +1000
    Re: All-numeric script names and import Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-23 10:58 +0200
    Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 19:02 +1000
    Re: All-numeric script names and import Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-23 11:22 +0200
    Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 19:28 +1000
    Re: All-numeric script names and import Michael Torrie <torriem@gmail.com> - 2014-05-23 16:52 -0600

csiph-web