On May 12, 10:04 pm, Terry Reedy wrote:
> On 5/12/2011 9:11 AM, JamesEM wrote:
>
>
>
> > I would prefer to generate the properties code dynamically from the
> > keys of the dictionaries.
> > What I am looking for is something like:
>
> > class MyClas
Hello,
I have a python class that contains a dictionary.
I would like to use python properties to access the elements of the
dictionary.
This could be achieved as follows:
class MyClass(object):
def __init__(self):
self.d = {}
d['field1'] = 1.0
d['field2'] = 'A'