Adding method at runtime - problem with self

bruno at modulix onurb at xiludom.gro
Mon Mar 6 08:30:47 EST 2006


marek.rocki at wp.pl wrote:
> Thank you all for your responses. That's exactly what I needed to know
> - how to bind a function to an object so that it would comply with
> standard calling syntax.
> 
> This is largely a theoretical issue; I just wanted to improve my
> understanding of Python's OOP model. Using such features in real life
> code would probably be classified either as excessive magic or bad
> design. 

or as a dirty-but-pragmatic workaround - just like accessing
implementation attributes. These are things that one should IMHO better
avoid if possible, but sometimes a simple hack is better than no
practical solution at all.

> Oh well, at least now I can be an informed participant of
> language holy wars :-)

Welcome on board !-)


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list