Automatic methods in new-style classes

bertgoos at yahoo.com bertgoos at yahoo.com
Fri Sep 29 14:37:57 EDT 2006


Hey, I have the following code that has to send every command it
receives to a list of backends. Instead of:

class MultiBackend(object):
    """Renders to multiple backends"""

    def __init__(self, backends):
        self.backends = backends

    def flush(self):
        for b in self.backends:
            b.flush()

    def draw(self):
        for b in self.backends:
            b.draw()


I would like to write each method like:

    flush = multimethod()

Is that possible using new-style classes?

Bert




More information about the Python-list mailing list