ykingma at accessforall.nl
Wed Aug 8 00:18:59 CEST 2001
> This is the second post of mine. First, I would like to thank all u that
> responded to first post. Here I repeat some of the questions of my first
> post, because they were not properly answered or cause I didn't get straight
> In the first post u answered me that in Unix based platforms "cat" command
> starts the creation of a module. OK, now I go on with some more queries.
On Unix I'd prefer to use vi over cat. Others use other editors like emacs,
or the editor in the Python development environment. But this subject is
off topic here.
> 1. When we type "dir()" in the interactive command line prompt get among all
> the others the module "__name__" which really tell us the name of the module
> that we are . But now we are in the interactive command line prompt, which
> is a module with the name "__main__". Now, my question is, why isn't
> __name__ = __main__? (Why isn't __name__ substituted by __main__?
This is simply a difference between interactive interpreter and the
'main python program' interpreter. The difference is not specified
by the language, it is just that these environments are not completely
the same: any python interpretation may start with some variables predefined.
> Sorry for repeating this question but I didn't really get a clear answer.
Even the docs are bit terse about this.
> 2. What is the difference between "!=" and "<>" (which really mean
I think only their origins are different: != comes from C, <> comes
from Pascal (who remembers Jensen and Wirth nowadays?).
In python they are equivalent, but it is possible that one of them
is more favoured.
> 3. Are the built-in tools (such as "len", "sort" etc) maintained in a folder
> into the Python directory, so as I can access and edit them?
They are implemented as functions in the implementation language,
currently C or Java. You can access them by extracting the sources
during python installation. In case you need the precise names of the
equivalent functions, just ask here.
> 4. What is the difference between "%d" and "%i" (which really point
> integer values)?
Pass, my C usage is too far in the past. See the docs on the % operator.
> 5. What does it mean that Python is a "high-level language" and other
> languages, such as C, are low-level?
In python you don't need to declare variables and a variable can be set to
a reference to a value of any type.
When the parser does not detect syntax error in Python, everything is executed
until an uncaught exception occurs. Execution of a declaration or import has the
effect of adding name(s) to the namespace used by the interpreter.
Other statements change the references/values of the names in the applicable
> Sorry for the simplicity of some of the above questions, but are crucial for
> me for the full understanding of Python.
> Thanks again for ur attention and immediate responds.
> Mail me: whats_really_hot at hotmail.com
By request. Please see the newsgroup for more answers.
email at xs4all.nl
More information about the Python-list