Re: issubclass(dict, Mapping)

2011-01-18 Thread Aahz
In article , kj wrote: > >standard OOP semantics "...some experts might say a C++ program is not object-oriented without inheritance and virtual functions. As one of the early Smalltalk implementors myself, I can say they are full of themselves." --zconcept -- Aahz ([email protected])

Re: issubclass(dict, Mapping)

2010-12-22 Thread Steven D'Aprano
On Thu, 23 Dec 2010 01:41:08 +, kj wrote: > In <[email protected]> Steven D'Aprano > writes: > >>On Wed, 22 Dec 2010 14:20:51 +, kj wrote: > >>> Here's another example, fresh from today's crop of wonders: >>> >>> (v. 2.7.0) >> from collections impo

Re: issubclass(dict, Mapping)

2010-12-22 Thread kj
In <[email protected]> Steven D'Aprano writes: >On Wed, 22 Dec 2010 14:20:51 +, kj wrote: >> Here's another example, fresh from today's crop of wonders: >> >> (v. 2.7.0) > from collections import Mapping > issubclass(dict, Mapping) >> True > di

Re: issubclass(dict, Mapping)

2010-12-22 Thread Steven D'Aprano
On Wed, 22 Dec 2010 14:20:51 +, kj wrote: > Here's another example, fresh from today's crop of wonders: > > (v. 2.7.0) from collections import Mapping issubclass(dict, Mapping) > True dict.__bases__ > (,) [issubclass(b, Mapping) for b in dict.__bases__] > [False] > > > S

Re: issubclass(dict, Mapping)

2010-12-22 Thread Terry Reedy
On 12/22/2010 9:20 AM, kj wrote: from collections import Mapping Documented as an *ABSTRACT* base class. ABCs were added in 3.0 and backparted to 2.7. One can be quite competant in Python completely ignoring ABCs. issubclass(dict, Mapping) True Yes, dict is a concrete Mapping class. I

Re: issubclass(dict, Mapping)

2010-12-22 Thread Ethan Furman
kj wrote: In a message (<[email protected]>) on a different thread, Steven D'Aprano tells me: I suspect you're trying to make this more complicated than it actually is. You keep finding little corner cases that expose implementation details (such as the heap-t

Re: issubclass(dict, Mapping)

2010-12-22 Thread Steve Holden
On 12/22/2010 9:20 AM, kj wrote: [...] > I suspect this is another abstraction leak ("dict is *supposed* to > be a Python class like all others, but in fact it's not *really*. > You see, once upon a time..."). > So your suspicions are to be placed above the knowledge of those who really do underst

Re: issubclass(dict, Mapping)

2010-12-22 Thread Antoine Pitrou
On Wed, 22 Dec 2010 09:35:48 -0500 Adam Tauno Williams wrote: > > IMO, the "object model" isn't "leaky", it is simply "adhoc" and not > really a "model" at all [write as many 800 page books as you want: if it > walks like a zombie duck, smells like a zombie duck - it is still a > zombie duck]. P

Re: issubclass(dict, Mapping)

2010-12-22 Thread Antoine Pitrou
On Wed, 22 Dec 2010 14:20:51 + (UTC) kj wrote: > > So dict is a subclass of Mapping, even though none of the bases of > dict is either Mapping or a subclass of Mapping. Great. > > I suspect this is another abstraction leak ("dict is *supposed* to > be a Python class like all others, but in

Re: issubclass(dict, Mapping)

2010-12-22 Thread Adam Tauno Williams
On Wed, 2010-12-22 at 14:20 +, kj wrote: > In a message (<[email protected]>) > on a different thread, Steven D'Aprano tells me: > >I suspect you're trying to make this more complicated than it actually > >is. You keep finding little corner cases that expose i