Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71863
| Date | 2014-05-21 09:24 -0500 |
|---|---|
| From | Mark H Harris <harrismh777@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: All-numeric script names and import |
| References | <mailman.10190.1400680014.18130.python-list@python.org> |
| Message-ID | <mailman.10198.1400684322.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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