Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] ruby and python in Japan



On Mon, 26 Feb 2007 11:34:48 +0900, Stephen J. Turnbull <turnbull@??> wrote:

Dave Brown writes:

 > Actually, however, Django isn't bad.  Its biggest flaws come from the
 > restrictiveness of the way that Python does things

What do you find restrictive about the way that Python does things?

Well, this is not restrictive but an annoying aspect is that you must explicitly declare self in all of your instance methods. It makes the OO aspect of Python feel tacked on.

> treating Python as if it were Ruby takes a bit of work--for instance,
> you can't casually reopen a previously-defined class and change it like
> you can with Ruby).


I've always considered that a feature, not a bug; that's what derived
classes are for.

What's the use-case for changing a class on the fly?

In most cases it is not a good thing, but there are times when it can be very useful. For example, if a standard API is broken you can simply open the class (such as cgi) and redefine a working method. Then, while you are waiting for the fixed patch to be accepted into ruby core you can keep using your monkey patch. This is important if you are distributing an app or framework and your clients do not have root access to explicitly patch the broken file. Also, Rails does some fun stuff with dates and numbers such as "5.days_from_now".

Zev


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links