"Vincent Gulinao" <[EMAIL PROTECTED]> wrote > Is there any way a reference to a class attribute > ([class].[attribute]) be > treated like a method ([class].[method]())?
Yes, classes are just objects and their attributes are too. class Test: pass def f(self): print 'howdy!' Test.foo = f t = Test() # creae an instance t.foo() # access the class method Creating actual class methods at runtime and calling them via the class is something I haven't tried but it might be possible... Yep it works: class Test: pass Test.foo = staticmethod(lambda: 'hello') Test.foo() 'hello' HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor