[Python-3000] Generic function PEP won't make it in time

Guido van Rossum guido at python.org
Wed Apr 25 23:19:27 CEST 2007


On 4/25/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> "Emin.shopper Martinian.shopper" <emin.shopper at gmail.com> wrote:
> > On 4/25/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> > > If your unit tests take hours to run, then you aren't going to get
> > > anything useful from the ABC requirements for hours either (unless you
> > > are pre-instantiating everything you are going to use during program
> > > execution, in which case this could become your unittest).
> >
> > No, the ABC requirements are checked as soon as a module is imported (i.e.,
> > classes are checked at definition time not when an instance is created). I
> > have been using my own ABC implementation for quite a while and it has
> > repeatedly proven it's value when I create a new derived class and forget to
> > implement a necessary method.
>
> But that is not part of the ABC PEP (according to my most recent reading).
> See the "ABC Support Framework" portion.  Only instantiation triggers
> the "you didn't implement method X". Certainly you can add metaclasses
> to handle checking for "does class X implement method Y", but it isn't
> going to be included out of the box.
>
> > I'm not claiming that is the only benefit of ABCs. I'm just pointing out
> > what I find to be a very useful feature of ABCs that I hope makes into
> > python.
>
> I doubt this particular feature will make it in.  It seems too
> "B&D"-static typing to me (and others).

IIUC, Emin's framework requires you to explicitly declare any class as
abstract that has abstract methods. IMO this is a requirement to
redundancy which I find unpythonic. So indeed I am not about to add
this to the PEP.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list