Home

Ricardo Aráoz wrote:
> That is self.__attributes
>
> Been reading about the reasons to introduce them and am a little
> concerned. As far as I understand it if you have a class that inherits
> from two other classes which have both the same name for an attribute
> then you will have a name clash because all instance attributes "wind up
> in the single instance object at the bottom of the class tree".
>
> Now I guess this means that in any real OOP project you'd better use
> __attr for all your attributes, because classes are usually meant to be
> subclassed and you can never know when you'll be subclassing from two
> classes with attributes with the same name, and I guess you can't take
> the risk of this happening because when it happens it will be hell to
> find out what's going on.
>
> Is this right?

Multiple inheritance isn't *all* that common, and haphazard multiple inheritance
is even less common. Don't use __attr unless if you have a *specific* need in
front of you, not just an abstract fear of rogue subclassers.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

previous
next

Re: Python 3K or Python 2.9?
Re: Convert on uppercase unaccentent unicode character
having a little problem with some code for a little game I am creating.
const data in descendant classes
Re: Important Research Project
Niechciane i Zapomniane
Dzieci Niczyje
Nasze Dzieci
Mam Marzenie
Pajacyk