Circular reference problem -- advice? (resolved)

Erik Max Francis max at alcyone.com
Mon Jul 10 16:36:47 EDT 2000


Thomas Wouters wrote:

> Don't forget that an instnace's __dict__ doesn't list methods, just
> data
> members. (instance methods are created on the fly, from the unbound
> versions, and not stored in the instance's __dict__.)
> 
> getattr() will work though, hadn't thought about that one ;)

Thanks for the responses, folks.  As it turned out, my question was more
involved than I originally thought (I actually cancelled my post right
after sending it), but with Thomas' help via email I was able to get
what I needed via a combination of apply and getattr, a rather more
elegant solution than an exec.  (I actually couldn't use method
references at all, because it needs to respect subclassing when
dispatching.)

In the general sense, I must say I'm quite pleased with Python.  This is
the one issue that I actually had to sit down and think about;
everything else has flowed naturally from my fingertips; my first
project was a chatterbot that hooks up to a friend's talker (so I had to
write the framework to be able to communicate with it first), and this
issue was the one sticky issue that came up during the entire process --
a good sign that it's well designed and easy to learn.

Thanks again.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Life is something to do when you can't get to sleep.
\__/ Fran Lebowitz
    Physics reference / http://www.alcyone.com/max/reference/physics/
 A physics reference.



More information about the Python-list mailing list