[Python-3000] Generic function PEP won't make it in time
jcarlson at uci.edu
Wed Apr 25 23:11:47 CEST 2007
"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
I doubt this particular feature will make it in. It seems too
"B&D"-static typing to me (and others).
More information about the Python-3000