There is more than one way to do it - and for no apparent reason.
mkeijzer at cs.vu.nl
Mon Feb 18 16:01:51 CET 2002
if it's syntactic sugar you want, create a base class that uses __getitem__ and
__setitem__. For instance like this:
def __getitem__(self, item):
def __setitem__(self, item, value):
self.__dict__[item] = value
Then you can do:
base = MyDerived()
base.name = 'hi'
base['name'] = 'ho'
If you have other uses for the  notation, you're still free to use it.
More information about the Python-list