__setattr__/__getattr__

Michael Hudson mwh21 at cam.ac.uk
Fri Mar 24 09:15:22 CET 2000


"Oleg Orlov" <orlov at diasoft.ru> writes:

> >From tutorial 9.6
> >
> >There is limited support for class-private identifiers. Any identifier
> >of the form __spam (at least two leading underscores, at most one
> >trailing underscore) is now textually replaced with _classname__spam,
> >where classname is the current class name with leading underscore(s)
> >stripped.
> 
> There is no such replacement inside ordinary methods of the class!
> Why __setattr__ is extraordinary?

Identifiers that start and end with `__' don't get munged, if that's
what you're asking.

Cheers,
M.

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list