On 6/16/10 6:10 AM, Peter Otten wrote:
> Thomas Lehmann wrote:
> 
>>> class AutoValueDict(dict):
>>>     def __makeitem__(self, key):
>>>         return self.setdefault(key, {})
> 
> I think it's bad style to invent your own __whatever__() methods, I'd rather 
> call them _whatever().

It goes a bit beyond bad style into, "it is explicitly forbidden", I think.

Not that "forbidden" means, "Python will prevent you from trying", just
that it says, "Don't do it."

Leading-and-trailing double underscores are explicitly reserved for
Python to define as Special. They also imply a slightly different
calling semantic: normal leading-and-trailing double underscore methods
bypass instance lookup.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to