[Python-3000] Generic function PEP won't make it in time (original) (raw)
Emin.shopper Martinian.shopper emin.shopper at gmail.com
Wed Apr 25 22:44:49 CEST 2007
- Previous message: [Python-3000] Generic function PEP won't make it in time
- Next message: [Python-3000] Generic function PEP won't make it in time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Please remember that this isn't about Java style type checking and
verification during compilation. This is, strictly speaking, ABC checking on object instantiation, method invocation, and possibly even argument verification. This isn't the magic bullet you are looking for (you'll have to go to one of those static typed languages for that).
Again, I disagree. With metaclasses it is easy and useful to have checking at class definition (see http://web.mit.edu/~emin/www/source_code/py_abc/abc.py for an example of what I mean). Generally I don't want static checking, but occasionally it is nice to have something like that and ABCs provide a good way to do that.
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. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20070425/43c2b864/attachment.htm
- Previous message: [Python-3000] Generic function PEP won't make it in time
- Next message: [Python-3000] Generic function PEP won't make it in time
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]