Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> What are disadvantages of a direct .len() instead of .__len__()?

I can think of a few arguments against getting rid of double
underscores in general.  First, special methods are a little like
keywords in that it would be nice to introduce new ones from time to
time without breaking existing code.  For example, using
getattribute instead of __getattribute__ could have broken existing
code.

Another advantage to using __getattribute__ is that it's normally a
method that users don't have to know about.  Even if there was no
problem with breaking existing code it still would be better to use
underscores.  Someone who doesn't yet know about the magic method
could become confused when they use the name for some other purpose.

Finally, there is an advantage to consistent naming.  Since some
special methods have double underscores, one could argue that they
all should have them.

  Neil

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to