En Tue, 07 Oct 2008 10:34:44 -0300, Michele Simionato
<[EMAIL PROTECTED]> escribió:
On Oct 3, 9:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
Ok, but then you have to explicitely decorate every method. To avoid
this,
you may use a metaclass; this article by Michael Foord explains
On Oct 3, 9:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> Ok, but then you have to explicitely decorate every method. To avoid this,
> you may use a metaclass; this article by Michael Foord explains
> how:http://www.voidspace.org.uk/python/articles/metaclasses.shtml#a-metho...
Since
On Fri, 03 Oct 2008 16:03:22 +0200, TP wrote:
> 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
Gabriel Genellina wrote:
En Fri, 03 Oct 2008 11:03:22 -0300, TP <[EMAIL PROTECTED]>
escribió:
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(
En Fri, 03 Oct 2008 11:03:22 -0300, TP <[EMAIL PROTECTED]>
escribió:
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
On Oct 3, 9:03 am, TP <[EMAIL PROTECTED]> wrote:
> 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
>
Maybe you can use __getattribute__.
I tried it, but got stuck trying to let __getattribute__
work normal without calling itself.
class A(object):
def foo(self):
print "hi"
class B(A):
def __getattribute__(self,name):
try:
fun = A.__dict__[name]
except K
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 ).