I find it more convenient to access dict keys as obj.foo instead of obj[\'foo\'], so I wrote this snippet:
obj.foo
obj[\'foo\']
class AttributeDict(dict
This is what I use
args = { 'batch_size': 32, 'workers': 4, 'train_dir': 'train', 'val_dir': 'val', 'lr': 1e-3, 'momentum': 0.9, 'weight_decay': 1e-4 } args = namedtuple('Args', ' '.join(list(args.keys())))(**args) print (args.lr)