[Python-Dev] ABCs and simplegeneric use case

Nick Coghlan ncoghlan at gmail.com
Mon Mar 2 21:20:54 CET 2009


Paul Moore wrote:
> 2009/3/1 Nick Coghlan <ncoghlan at gmail.com>:
>> As much as I'd like to get a simple generic implementation into
>> functools, the lack of support for ABCs still bothers me (despite my
>> last post about that on the tracker item). I'd be a -0 on it going in as
>> is, but if someone can figure out a clever way of supporting ABCs
>> without completing killing the invocation speed for generics, that would
>> go up to a +1.
> 
> Nick,
> Armin Ronacher pointed out that it's not likely to be possible to
> enumerate ABCs even in theory, as ABCs can do semantic checks (e.g.
> checking for the presence of special methods like __iter__) without
> needing either inheritance or explicit registration.
> 
> As you had a genuine use case for simplegeneric, how badly does this
> limitation damage it?

That's a very good point that Armin raises (i.e. that enumerating the
ABCs a given class implements is impossible even in theory, let alone in
practice). It is actually enough to put me back to the perspective that
I posted on the tracker item: the failure to inherit generic function
implementations when a class doesn't actually have the ABC in its MRO is
similar in nature to the failure to inherit the ABCs own method
implementations.

It still bugs me a little, but I'll get over it :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list