K-Dawg wrote:

I do no understand the underscore methods.

Names of the form __xyx__ are defined by the language definition and recognized and used by the interpreter.

See PythonLanguage / LexicalAnalysis / Identifiers / Reserved

Most refer to methods, a few to other attributes. Modules may have several non-method attributes, such as '__builtins__', '__doc__', '__file__', '__name__', and '__package__'.

The top-level module created when the interpreter starts is given the name '__main__'. If a module is imported, it __name__ is the import name.

>>> __name__
'__main__'
>>> import email
>>> email.__name__
'email'
>>> email.__file__
'C:\\Programs\\Python30\\lib\\email\\__init__.py'

If email were run directly, its name would be __main__ while the __file__ would be the same.

Most syntax operations have a corresponding special that implements the operation. This allows user-defined objects to fully participate in syntax operations on an equal basis with built-in objects.

See PythonLanguage Manual / Data model / Special operations.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to