inherrited private class varriables
Mark McEahern
marklists at mceahern.com
Mon Jun 17 19:21:44 EDT 2002
> why can't i access a class private varriable from within a predecessor?
You can, but you have to use the mangled name:
mangled_name = "_%s%s" % (self.__class__.__name__, "__length")
l = getattr(self, mangled_name, self.__length)
print l
Of course, if you don't want to torture yourself, you could just use _length
instead. ;-)
Cheers,
// mark
-
More information about the Python-list
mailing list