development/languages

python-bunch - Python dictionary with attribute-style access

Website: http://tire.less.ly/hacking/bunch
License: MIT
Vendor: Fedora Project
Description:
python-bunch provides a python class which can perform as a dict whose keys are
also accessible as attributes, similar to JavaScript objects.  For instance::

  >>> import bunch
  >>> people = bunch.Bunch({'alice': 'here', 'bob': 'there'})
  >>> print people['alice'], people.alice
  here here

The piece of python-bunch that sets it apart from similar modules found inside
other projects is the bunchify() function which recursively converts from
a dict to a Bunch::

  >>> multi_level = {'array': ['scalar', {'mapping': 'to show recursion'} ]}
  >>> bunch.bunchify(multi_level)
  Bunch(array=['scalar', Bunch(mapping='to show recursion')])

Packages

python-bunch-1.0.0-2.fc14.noarch [10 KiB] Changelog by Toshio Kuraotmi (2010-07-30):
- Rebuild for python-2.7

Listing created by Repoview-0.6.6-2.fu2012