Movatterモバイル変換


[0]ホーム

URL:


PEP 245

Alex Martellialeaxit at yahoo.com
Tue Apr 3 09:37:21 EDT 2001


"Paul Robinson" <paul.robinson at businesscollaborator.com> wrote in messagenews:mailman.986302445.8830.python-list at python.org...>>> Alex Martelli wrote:> >> > "Alex Shindich" <shindich at itginc.com> wrote in message> > news:mailman.986255463.27488.python-list at python.org...> > > >in C++, one normally uses _private_ inheritance for this specificpurpose> > > There is nothing private in Python. There is "__" name mangling ofcourse,> > > but that is it.> >> > Exactly.  In particular, '__' name mangling does not apply toinheritance.>> What exactly did you mean by that?That there is no "__ name mangling" to give the effect of privateinheritance, as mentioned in the very first line above.  Names ofattributes starting with __ do get mangled the same way no matterwhat inheritance is going to happen or not happen, of course; butthis mangling concept in no way applies to _inheritance itself_,leaving no Python way to express "private inheritance".The context, I remind you, was whether it was a good idea todistinguish "implementing an interface" vs "using another classin one's implementation", two concepts that C++ somewhat mergesand confuses (but sort-of-separates again by using _private_inheritance to express 'implemented-in-terms-of').Alex


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp