Python Notes

Wednesday, January 05, 2005

Concepts & Generic Programming

On a recent thread on comp.lang.python (which originally discussed some perceived problems about Python evolution, the topic of generic programming was brought up by Roman Suzi. In ensuing debate, there were some great posts, specially one by Alex Martelli (once again), where he goes into detail to explain why Python interfaces are different. Roman wrote a great followup to it, pointing out that concept is a better choice of words; it is a less overloaded word than interface, and it goes beyond it in many senses.

All this stuff left me wondering. One of the highlights of Python is that the language doesn't stays in the way between the programmer and the problem. I may be totally off target here, but I feel that things such as type annotations may become an artificial barrier; something that really does not belong to the problem, but is necessary due to the limitations of the medium.

The subject is far from dead. I'm not a language laywer, and I tend to have a bad time naming things, so forgive me while I ramble... One of the things that I feel is necessary is to enforce the abstract nature of interfaces. In other words: please, don't make type annotations part of the def statement. My gut feeling is that all this could be part of a unifying framework; an abstract class system, something that could provide the foundations for the very class hierarchy, including metaclasses, and also for the type annotation.

Going even further - and I'm better stop soon before I get named as totally crazy & misguided - concepts could provide a foundation for a much bigger set of stuff. Many standard statements would easily fall in this category. But as I said, I'm better stop with it before I say something silly...

19 Comments:

Post a Comment

<< Home