python内部类的一句话优雅实现
定义类
class foo(dict):
__getattr__, __setattr__ = dict.get, dict.__setitem__
测试
args = foo();
args.gan_type = 'GAN'
args.dataset = 'mnist'
#通过
定义类
class foo(dict):
__getattr__, __setattr__ = dict.get, dict.__setitem__
测试
args = foo();
args.gan_type = 'GAN'
args.dataset = 'mnist'
#通过