Friday, March 25, 2005

Static typing and Interfaces in Python

OK. So here's the obligatory weigh-in on static typing in Python. I don't see why we need to introduce a new syntax fior something that could be handled very cleanly with decorators (and I'm sure many people have argued this point).

I also choke on the whole "Interface" thing. We don't need those either. Just create a class with a bunch of raise 'Not Implemented' statements for all the method implementations. Anybody subclassing the class would be forced to implement the methods. We could even have a meta-class for it that checks that all the methods are implemented - again, no need for extended syntax.

One of the things I like most about python is its consistency: things usually work the same way. Let's keep it nice, simple and predictable.

On a slightly related note I see that the BDFL is considering wiping out map, filter and reduce. I applaud this since the list comp syntax neatly handles these functions' roles.

1 comment:

Jonathan said...

Come, join the Ruby flock, my son.