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

class Foo(object):
    def __init__(self):
        for k in dir(self) :
            if not k.startswith('__') :
                v = getattr( self, k )
                v()
    def test(self):
        print 'The test method'
    def hello(self):
        print 'Hello user'


you can also add a test for 'if callable(v) :' to the for loop if you
have data fields in Foo.

Regards
Sreeram

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to