Need a compelling argument to use Django instead of Rails

Joe Knapka jk.usenet at kneuro.net
Tue Jul 25 18:32:45 EDT 2006


John J. Lee wrote:

> The fact that "open classes" are apparently thought to be a good thing
> in Ruby puzzles (and worries) me.

This objection strikes me as having the same
nature as, "Python's lack of strong protection for
class members puzzles (and worries) me".  The Pythonic
answer to that objection is usually that this is a
feature: it lets people who know what they're doing
solve problems more easily than if they had to work
around a bunch of "helpful" protection.

Classes are effectively open in Python, too, at least
where methods are concerned, since one can do
klass.__dict__["myMethod"]=myMethod.
Though admittedly, it isn't widely advertised as a
feature of Python.

It makes sense to me to think of open classes as being
open for extension, not modification. After all, methods
added by clients are unlikely to depend on
implementation details (though I suppose they could, to
which I would say, "Don't do that").

Steve Yegge's "Opinionated Elf" is an example of a problem
that is very easy and elegant to solve with open classes,
and painful to solve when classes are closed:
http://www.cabochon.com/~stevey/blog-rants/polymorphism-fails.html

Cheers,

-- JK



More information about the Python-list mailing list