In <[EMAIL PROTECTED]>, per9000 wrote:

> I just used a search engine a little on this topic and I found no
> comprehensive list of magic names in python.

They are usually mentioned in parts of the docs where the relevant
functionality is explained.  For example in `Special method names`_ in the
reference manual.

And of course all covered in the reference manual are under
`_ (underscore)`_ in its index.  In the `library reference's index`_
you'll find some more that are used by modules.

.. _`_ (underscore)`: http://docs.python.org/ref/genindex.html#letter-_
.. _library reference's index: http://docs.python.org/lib/genindex.html
.. _Special method names: http://docs.python.org/ref/specialnames.html

>  * are these lists complete or can magic names be added over time (to
> the python "core")?

Magic names can be added over time.  For example the ``with`` statement
introduced `__enter__()` and `__exit__()` in Python 2.5.  And some special
names may even change were the docs say so or if they aren't mentioned at
all in the docs.

>  * are magic names the same in different python versions?

Yes.

> So another question emerges:
>  * is the use of magic names encouraged and/or part of good coding
> practice.

What do you mean by "use"?  Implement them to override behavior?  Yes,
that's their purpose.  Invent new magic names?  No of course not, they are
special for a reason:  preventing name clashes with the user's names.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to