On Dec 11, 4:42 pm, Nobody <nob...@nowhere.com> wrote:
> If just you're trying to avoid getting a repetitive strain injury in your
> right-hand little finger from typing all the [''], you could turn
> the keys into object attributes, e.g.:
>
>         class DictObject:
>             def __init__(self, d):
>                 for key, value in d.iteritems():
>                     setattr(self, key, value)
>         ...
>         o = DictObject(D)
>         # use o.a, o.b, etc

I hate this kind of laziness. I'd spend at least 5 minutes trying to
work out _why_ someone felt this was necessary and then get annoyed
that it was just to avoid typing.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to