[Python-3000] Generic function PEP won't make it in time
emin.shopper at gmail.com
Wed Apr 25 23:56:13 CEST 2007
On 4/25/07, Guido van Rossum <guido at python.org> wrote:
> IIUC, Emin's framework requires you to explicitly declare any class as
> abstract that has abstract methods.
I believe that is an easily fixable implementation issue, which I would be
happy to remedy.
I think a bigger issue is whether to check at definition time or check at
instantiation time. It seems to me the former has the benefit of catching
errors earlier and potentially saving time. I don't immediately see the
advantage of the latter (probably that is due to my lack of imagination).
I would like to see the PEP include the ability to (optionally) enforce ABC
requirements at definition time. For example, you could set an attribute (
e.g., __check_abstract__) or inherit from something special if you want to
turn enforcement on (if not checking at def time is the default) or turn it
off (if checking at def time is the default). I am not recommending that
anyone be forced to conform to this to use anything in the standard library.
I think this would be useful, not conflict with the other goals of the PEP,
and be relatively easy to implement in pure python (as illustrated by my
example implementation). If others find this useful (or at least not
objectionable), I would be happy to help with the implementation or writing
additional material for the PEP or even propose it separately if people
think this distracts from the point of the original ABC PEP.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-3000