Jameson Quinn wrote:
"class attrdict" is a perennial dead-end for intermediate pythonistas who want to save 3 characters/5 keystrokes for item access. Other languages such as javascript allow "somedict.foo" to mean the same as "somedict['foo']", so why not python?
I think the main reason this is a dead end is these intermediate pythonistas eventually come to realise that, if you program pythonically, it's actually extremely rare that you need to index a dictionary with a constant. Either you have a mostly-fixed set of field names, in which case you should be using a custom class instead of a dict, or the set of keys is dynamic, in which case you're mostly indexing with computed values. Lots of somedict['foo'] appearing is a code smell. So there wouldn't be enough use for a somedict..foo syntax to justify its existence. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com