alex23 wrote:
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.
For me, half of it is to avoid the typing, the other half to avoid the
reading. ;)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list