Python evangelists unite!

Jyrinx jyrinxatmindspringdotcom
Mon Dec 3 03:40:36 EST 2001


> For example, I'm writing a Ruby binding to the Object-Oriented
> database GOODS.  Some objects are persistent, some are transient.  You
> don't know at "compile time" which are which, so it's very nice for my
> binding to be able to add persistence support methods at run-time only
> to those objects that will be stored in the database.  Without Ruby's
> support for adding these methods to individual objects, I'd have to
> modify the class, which would mean adding all this persistence-related
> stuff to transient objects.  Ruby allows a much cleaner solution: add
> the persistence support methods only to those objects that need them.

Under the basic premises of OO, shouldn't you just have a base class with
derived classes "persistent" and "transient," or some such? I'd think this
would make clearer your intent for the uses of the objects.

Jyrinx
jyrinx at mindspring dot com





More information about the Python-list mailing list