Private identifiers - naming
Heiko Wundram
heikowu at ceosg.de
Thu May 6 10:16:19 EDT 2004
Am Donnerstag, 6. Mai 2004 16:00 schrieb Sridhar R:
> Any thoughts?
If you find "__varname" difficult to read, don't use it. Python doesn't hide
(try a dir(<instance>)) or protect access to these variables anyway, so you
actually gain nothing using this syntax if it makes it cryptic for you.
The old argument: "We're all mature enough not to fiddle with data members
that are not of our concern, but rather use the interface the class defines
for us." And of course, if a class really wants us to not use a data member,
this can all be stated in the doc-strings for the class. ;)
And, btw., I've actually found it rather helpful to have full access to
classes (as long as I know the source of the class), so that I can patch in
functionality that the author may have "forgotten" to implement...
Heiko.
More information about the Python-list
mailing list