derived / base class name conflicts
Steven Bethard
steven.bethard at gmail.com
Wed Nov 16 12:47:37 EST 2005
christopherlmarshall at yahoo.com wrote:
> so the following would not result in any conflicts
>
> class A:
> def __init__(self):
> self.__i= 0
>
> class B(A):
> def __init__(self):
> A.__init__(self)
> self.__i= 1
>
Be careful here. The above won't result in any conflicts, but related
cases, where you have two classes with the same name in different
modules, may still result in conflicts. See my previous posts on this:
http://groups.google.com/group/comp.lang.python/msg/503984abaee1c2b5
http://groups.google.com/group/comp.lang.python/msg/f03183a2c01c8ecf
However, I tend not to use double-underscore name mangling, and I don't
think I've ever had a shadowing problem, so clearly I wouldn't have
shadowing problems with double-underscore name mangling either...
STeVe
More information about the Python-list
mailing list