[Tutor] Very basic help

Magnus Lycka magnus@thinkware.se
Sun Jan 26 16:44:01 2003


At 14:59 2003-01-25 -0600, Gary Calvert wrote:
>9-20.py

Hi Gary. Python files can be loaded into other python programs
as modules as you know. This requires that the main part of
the file name (the part before .py) can be a python identifier.
9-20 is a numerical expression with the value -11. so it's
not a permitted name in python. A python identifier can only
contain A-Z, a-z, 0-9 and _, and it can't begin with a digit.
NineToTwenty.py or _9to20.py etc will do, but 9-20.py can't
be used as a module. Maybe you didn't intend that, but I still
think it is a good practice to use file names that are legal
identifiers for all python source code. Who knows, you might
be in the python interpreter and want to import your file to
test it interactively.

Apart from the restrictions concerning character set, and
initial digit, you can't use reserved names such as 'if', 'for'
and 'class' as module (or variable) names.




-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se