issubclass(dict, Mapping)

Steve Holden steve at holdenweb.com
Wed Dec 22 10:31:06 EST 2010


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 understand Python's object model? That seems like a recipe for
cargo cult programming ...

> I conclude that, for me to understand Python's (rather leaky) object
> model abstraction, I have to understand its underlying implementation.
> Unfortunately, as far as I know, there's no other choice but to
> study the source code, since there's no other more readable
> description of this implementation.
> 
You don't have to understand "the implementation" (there are at least
five different implementations, which one will you choose as your standard?)

> Maybe there are fewer "abstraction leaks" in 3.0... 
> 
Python deliberately exposes introspection interfaces, which you may use
if you wish. As with all introspectable languages (including Java) if
you push the envelope you are likely to hit corner cases. As Steven
d'Aprano has already said, these *are* corner cases and not the whole of
the language.

Don't worry about having a complete knowledge of the language before you
start to use it. That can induce paralysis ...

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list