[Python-Dev] Confirming status of new modules in 3.4

Nikolaus Rath Nikolaus at rath.org
Sun Mar 16 19:24:34 CET 2014


Charles-François Natali <cf.natali at gmail.com> writes:
> 2014-03-15 21:44 GMT+00:00 Nikolaus Rath <Nikolaus at rath.org>:
>
>> Guido van Rossum <guido at python.org> writes:
>> > This downside of using subclassing as an API should be well known by now
>> > and widely warned against.
>>
>> It wasn't known to me until now. Are these downsides described in some
>> more detail somewhere?
>>
>
> The short version is: "inheritance breaks encapsulation".
>
> As a trivial and stupid example, let's say you need a list object which
> counts the number of items inserted/removed (it's completely stupid, but
> that's not the point :-):
>
> So you might do something like:
[...]

Very illuminating example, thanks a lot!


Best,
-Nikolaus

-- 
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Python-Dev mailing list