下面这个例子演示了支持任意属性的Python类。
'''
Created on 2016-5-4
@author: Administrator
'''
import time
class Book:
def hello(self,next='Default'):
print 'helo',next
return 'hello '+next
def __getattr__(self,name):
print 'name'
return self.hello;
book = Book();
book.sss()
book.bbb()
book.eee()
book.ddd()
print book['ss']