''' Created on 2011-9-30 @author: xgzhao ''' class MyData(): pass #The instance attributes need not bo be defined in the class, just use it mathObj = MyData(); mathObj.x = 3 mathObj.y = 4 print mathObj.x + mathObj.y print mathObj.x * mathObj.y class MyDataWithMethod(): 'the doc of this class' myData = 123 def printFoo(self): print 'You invoked printFoo()' mathMethod = MyDataWithMethod() mathMethod.printFoo() print MyDataWithMethod.__doc__ print MyDataWithMethod.__name__ print MyDataWithMethod.__dict__