Charles-François Natali <cf.nat...@gmail.com> writes:
> 2014-03-15 21:44 GMT+00:00 Nikolaus Rath <nikol...@rath.org>:
>
>> Guido van Rossum <gu...@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.«
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to