[Python-ideas] getitem/getattr access

Oleg Broytman phd at phdru.name
Thu Mar 24 13:36:10 CET 2011


On Thu, Mar 24, 2011 at 06:23:20AM -0600, 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']",
> they think, so why not python?

   See class DictRecord at
http://ppa.cvs.sourceforge.net/viewvc/ppa/qps/qUtils.py

d = DictRecord(test="test")
print d.test

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.



More information about the Python-ideas mailing list