I even recalled a problem i had early on with the tutorial that may
need repair.
Glancing back through the tutorial, i recall how i was perplexed by my
inability to refer to sys.argv, as mentioned in section 2.1.1
("Argument Passing"). The problem, of course, was that i hadn't known
to do an 'import sys', and i didn't understand why i should need to do
so. (I don't think that the need to do so is at all obvious at that
point - it only begins to be clarified much later on, when modules are
covered.) I think some mention of doing the import should be included
before referring to one of its values, for those of us that like to
try things as we encounter them.
More generally, it occurred to me that there are some basic system
module components (particularly sys and os) that are essential at the
beginner level. Perhaps there should be some material on them
somewhere in the tutorial. Just a few items would enable much more of
a sense of the ability to connect the interpreter with the general
operating environment. Some items that come immediately to mind are:
- sys:
- sys.path
- sys.exc_type and sys.exc_value
- sys.stdin, .stdout, and .stderr (and implicit file methods)
- os
- os.getcwd()
- os.chdir()
- os.path
- os.path.expanduser() and .expandvars()
It may also be worthwhile to include some examples of use of the pdb
debugger - it's not complicated once you get the hang of it, but i
think it can be pretty obscure at first.
(I realize this is a totally different kind of topic than multiple,
coexisting interpreters or lazy lists. I hope it doesn't slip by the
way, though - the better we provide for our beginners, the more
beginners will stick with python, and the more favorable python will
be to the larger user community...)
Ken
ken.manheimer@nist.gov, 301 975-3539