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


Groups > comp.lang.python > #71860 > unrolled thread

Re: All-numeric script names and import

Started byChris Angelico <rosuav@gmail.com>
First post2014-05-22 00:43 +1000
Last post2014-05-22 00:43 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-22 00:43 +1000

#71860 — Re: All-numeric script names and import

FromChris Angelico <rosuav@gmail.com>
Date2014-05-22 00:43 +1000
SubjectRe: All-numeric script names and import
Message-ID<mailman.10195.1400683422.18130.python-list@python.org>
On Thu, May 22, 2014 at 12:32 AM, Dave Angel <davea@davea.name> wrote:
> I don't think there's any question of dumbhood,  but the answer
>  should be found in the formal grammar document.

Yeah, I figured it'd be an issue of the grammar. It expects 1 to mean
an integer, not a name - which in most contexts is correct (you can't
go "1 = 2" because 1 isn't a name). In some contexts you can force a
different interpretation, so for instance you can look at attributes
of an integer literal as (1).real even though 1.real is an error; but
I couldn't find a way to fiddle this one. And the only way I could
find to pass a string was to use __import__(). So is that the only
way?

Same thing would happen, I guess, if you have dots in the file name. A
file called "foo.bar.py" probably can't be imported.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web