execute a function before and after any method of a parent class

TP Tribulations at Paralleles.invalid
Fri Oct 3 10:03:22 EDT 2008


Hi everybody,

I would like to be able to specialize an existing class A, so as to obtain a
class B(A), with all methods of B being the methods of A preceded by a
special method of B called _before_any_method_of_A( self ), and followed by
a special method of B called _after_any_method_of_A( self ).

The goal is to avoid to redefine explicitly in B all methods of A.

Is this possible in Python?

Thanks a lot

Julien

-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.9&1+,\'Z
(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)



More information about the Python-list mailing list