newbie-name mangling?

Diez B. Roggisch deets at
Tue Dec 13 22:15:02 CET 2005

> Could someone provide an example of the above or direct me to a page
> where it is used.

class MangledMembers:

     def __init__(self):
         self.__mangled_propertyname = "fooo"

mm = MangledMembers()

     print mm.__mangled_propertyname
except AttributeError:
     print "It's private!"

print "But I can get it:", mm._MangledMembers__mangled_propertyname

Look at the code, and carefully reread the paragraph in the tutorial.



More information about the Python-list mailing list