[Python-ideas] item/attr dual access (was: 'bag' type)
Oleg Broytman
phd at phd.pp.ru
Thu Apr 15 11:01:44 CEST 2010
On Wed, Apr 14, 2010 at 10:12:38PM -0700, C. Titus Brown wrote:
> I just would like to be able
> to refer to dictionary keys as attributes. So I guess the cookbook recipe
> distracted you from my real interest, which is the short notation:
>
> b = bag(foo=bar, bif=baz)
>
> assert b.foo == bar
> assert b.bif == baz
See class DictRecord at
http://ppa.cvs.sourceforge.net/viewvc/*checkout*/ppa/QPS/qps/qUtils.py
License: Python.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list