[Python-3000] Generic function PEP won't make it in time
Jim Jewett
jimjjewett at gmail.com
Thu Apr 26 00:20:18 CEST 2007
On 4/25/07, Emin.shopper Martinian.shopper <emin.shopper at gmail.com> wrote:
> 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).
The advantage of waiting is that you can *have* (partially) abstract
classes. So long as you never instantiate them directly (super calls
are OK), everything is fine.
If you want an earlier check, then just create an instance of your
class at import time (or, alternatively, in your unit tests). If it
can be created, it passed the test.
-jJ
More information about the Python-3000
mailing list