decorating base methods

A

Alexandru Mosoi

I want to derive a base class, such that some methods are decorated.

The only thing I have in mind is:

class Base(object):
def A(self, x): pass
def B(self, y): pass

class Derived(Base):
@decorator
def A(self, x): Base.A(self, x)

Is this correct approach? How can avoid call to Base.A(...)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top