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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4