Tangram for Python?

Andrew M. Kuchling akuchlin at mems-exchange.org
Wed Mar 8 23:55:07 CET 2000


Jean-Louis Leroy <jll at skynet.be> writes:
> Can that be done from outside the class? For example, is it possible
> for a module like Tangram to add these attribute methods on the fly?

Yes, you can just assign a new __getattr__ to an instance (or class):

class userClass: 
    ... whatever ...
instance = userClass()

def my_getattr(self, name): 
    ... whatever ...

instance.__getattr__ = my_getattr
userClass.__getattr__ = my_getattr

Coexistence with an existing __getattr__ method would require saving it

> I was wondering, is it imaginable that people or companies from the
> Python community would sponsor a Python port? Via cosource.com? For
> starters, how many are interested in an object-relational mapper à la
> Tangram?

We couldn't sponsor it, unfortunately, but it's something that might
be useful on my current project, and I suspect many people could use
it in combination with Zope, to tie into an existing RDBMS model.
Bonus points if it can also sit on top of a different mechanism for
the sake of people who want persistent storage without running a
separate DB process.  (Gadfly?  The MetaKit/SQL combination currently
being developed?)

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
    "And Davros is never wrong about anything."
    "Then he must be exceptional; even I'm occasionally wrong about some
things."
    -- Ronson and the Doctor, in "Genesis of the Daleks"




More information about the Python-list mailing list