[Python-3000] Generic function PEP won't make it in time (original) (raw)
Calvin Spealman ironfroggy at gmail.com
Wed Apr 25 19:37:47 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, Emin.shopper Martinian.shopper <emin.shopper at gmail.com> wrote:
I disagree. I think that B&D-ish enforcement of ABCs is the most important feature of an ABC (with the option of being able to turn off enforcement on a per-class basis).
Imagine you have a program that takes a long time to run. If you use duck-typing or similar ideas you may watch the program run for hours or days and then raise an AttributeError or NotImplemented error because a derived class didn't implement a required method. With B&D-ish enforcement of ABCs, you can automatically catch such problems as soon as the program starts. This is a problem that I see no other good solution to. For long running programs, unit-tests will also take a long time to run so the argument that your unit-tests should catch such errors is no longer valid. Also, while pylint and pychecker are great tools that could be used to catch such errors, they must be run manually by the programmer and generally take a long time to run (at least longer than the ABC implementation I! have). To reiterate, while I think the documentation and reflection benefits of ABCs are nice, I don't think they are nearly as essential as enforcement. For most of the use cases I've seen, you could just as easily read the documentation or the source code or try a simple example to determine how to implement an iterable or hashable that will play nice with other classes. In contrast, ABC enforcement provides the real benefit of catching errors before many hours of program runtime are wasted. Consequently, I'm +1 on B&D in this case. -Emin Martinian
It sounds like you just need better unit tests.
-- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://ironfroggy-code.blogspot.com/
- 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 ]