[Python-3000] Generic function PEP won't make it in time
Guido van Rossum
guido at python.org
Thu Apr 26 01:32:03 CEST 2007
On 4/25/07, Emin.shopper Martinian.shopper <emin.shopper at gmail.com> wrote:
> 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'm confused. Can you show a simple example of something that can be
checked at definition time? Using the machinery currently in the PEP,
any class that inherits an abstract method and doesn't override it is
automatically an abstract class itself. There's nothing to complain
about at definition time.
> 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.
So I'm confused about what you can enforce. (And I do hope you will
read the PEP before replying.)
> 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.
Your example implementation was a bit too much code for me to read.
:-) Please show some usage examples instead.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list