Underscore data hiding (was python development practices?)
Toby Dickenson
tdickenson at devmail.geminidataloggers.co.uk
Mon Nov 5 07:35:58 EST 2001
More information about the Python-list mailing list
Mon Nov 5 07:35:58 EST 2001
- Previous message (by thread): Underscore data hiding (was python development practices?)
- Next message (by thread): Underscore data hiding (was python development practices?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
barry at zope.com (Barry A. Warsaw) wrote: >FWIW, the double-leading-underscore-no-trailing-double-underscore name >mangling rule wasn't added specifically for data hiding. It was so >that a class that was designed to be subclassed could have a namespace >that subclasses couldn't accidently trample on: Interestingly, I often find that that the chosen mangling scheme doesnt achieve that design goal. The scheme mangles the class name into the underscore-stripped attribute name, which offers zero protection if your base classes and subclasses have the same name. Does this happen often? A common structure (for me, anyway) is to have modules BaseWidget, FooWidget, and BarWidget, all of which define a class Widget. Toby Dickenson tdickenson at geminidataloggers.com
- Previous message (by thread): Underscore data hiding (was python development practices?)
- Next message (by thread): Underscore data hiding (was python development practices?)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list