Calling every method of an object from __init__

Rob Cowie cowie.rob at gmail.com
Mon Jun 19 15:55:53 EDT 2006


Hi all,

Is there a simple way to call every method of an object from its
__init__()?

For example, given the following class, what would I replace the
comment line in __init__() with to result in both methods being called?
I understand that I could just call each method by name but I'm looking
for a mechanism to avoid this.

class Foo(object):
    def __init__(self):
        #call all methods here
    def test(self):
        print 'The test method'
    def hello(self):
        print 'Hello user'

Thanks,

Rob C




More information about the Python-list mailing list