Why less emphasis on private data?

Paul Rubin http
Mon Jan 8 04:35:08 EST 2007


"Paul Boddie" <paul at boddie.org.uk> writes:
> Has this ever been reported as a bug in Python? I could imagine more
> sophisticated "name mangling": something to do with the identity of the
> class might be sufficient, although that would make the tolerated
> "subversive" access to private attributes rather difficult.

If you mean the object id, I don't think you can use it for name
mangling, since the mangled names have to survive code marshalling
and you may end up with different object id's.

I've just never encountered any legitimate use for the "subversive"
access and if it's really necessary, it's better to do it through some
kind of well-designed reflection interface in the class, rather than
with a crock like name mangling.



More information about the Python-list mailing list