Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71863
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <harrismh777@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'scripts': 0.03; 'assuming': 0.09; 'name?': 0.09; 'prefix': 0.09; 'subject:script': 0.09; 'python': 0.11; 'question.': 0.14; 'dumb.': 0.16; 'name)': 0.16; 'numbered': 0.16; 'pulling': 0.16; 'received:10.20.200': 0.16; 'received:209.225': 0.16; 'received:209.225.8': 0.16; 'received:charter.net': 0.16; 'script?': 0.16; "someone's": 0.16; 'subject:import': 0.16; 'alpha': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'app': 0.19; 'module': 0.19; 'import': 0.22; 'otherwise,': 0.22; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'received:24': 0.27; 'chris': 0.29; 'am,': 0.29; 'character': 0.29; "doesn't": 0.30; "i'm": 0.30; 'run': 0.32; 'open': 0.33; 'received:10.20': 0.33; 'skip:_ 10': 0.34; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'acceptable': 0.36; 'idle': 0.36; 'right?': 0.36; 'application': 0.37; 'received:209': 0.37; 'received:10': 0.37; 'being': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'tell': 0.60; "you're": 0.61; 'back': 0.62; 'name': 0.63; 'our': 0.64; 'answer.': 0.68; 'click': 0.77; 'subject:All': 0.84; 'hand,': 0.93 |
| X-Authority-Analysis | v=2.0 cv=F7QP7ddN c=1 sm=1 a=LkTX9YPXWU1lnSxlYEpgVg==:17 a=IuL6hPCtAYgA:10 a=9qL8LEEPaUMA:10 a=nDghuxUhq_wA:10 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=-Kw6OlLYRphbXTKl_-gA:9 a=QEXdDO2ut3YA:10 a=LkTX9YPXWU1lnSxlYEpgVg==:117 |
| Date | Wed, 21 May 2014 09:24:30 -0500 |
| From | Mark H Harris <harrismh777@gmail.com> |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.python |
| To | python-list@python.org |
| Subject | Re: All-numeric script names and import |
| References | <mailman.10190.1400680014.18130.python-list@python.org> |
| In-Reply-To | <mailman.10190.1400680014.18130.python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <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> |
| Message-ID | <mailman.10198.1400684322.18130.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1400684322 news.xs4all.nl 2913 [2001:888:2000:d::a6]:35223 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71863 |
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 | 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