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 (a...@pythoncraft.com)

Re: issubclass(dict, Mapping)

2010-12-22 Thread Steven D'Aprano
ers: >>> >>> (v. 2.7.0) >>>>>> from collections import Mapping >>>>>> issubclass(dict, Mapping) >>> True >>>>>> dict.__bases__ >>> (,) >>>>>> [issubclass(b, Mapping) for b in dict.__bases__] >

Re: issubclass(dict, Mapping)

2010-12-22 Thread kj
In <4d127d5e$0$29997$c3e8da3$54964...@news.astraweb.com> 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 collectio

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__ > (,) &

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
'? It sounds to me like you are looking at 'master'. 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

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
ot;implementation details". When an abstraction > leaks, implementation details are no longer negligible, they cease > to be "little corner cases". > Here's another example, fresh from today's crop of wonders: > (v. 2.7.0) > >>> from collections

issubclass(dict, Mapping)

2010-12-22 Thread kj
to be "little corner cases". 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.__bas