[Patches] [ python-Patches-1094542 ] add Bunch type to collections module

SourceForge.net noreply at sourceforge.net
Sun Jan 2 20:20:07 CET 2005


Patches item #1094542, was opened at 2005-01-02 13:26
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1094542&group_id=5470

Category: None
>Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Bethard (bediviere)
Assigned to: Nobody/Anonymous (nobody)
Summary: add Bunch type to collections module

Initial Comment:
This patch adds a proposed Bunch type to the
collections module which complements Python's dict
type, which provides a name-value mapping through the
__getitem__ protocol, with the Bunch type, which
provides an attribute-value mapping through
dotted-attribute access.

Example:
>>> x = Bunch(spam=Bunch(rabbit=1, badger=[2, 3, 4]),
ham='neewom')
>>> x.spam.badger
[2, 3, 4]
>>> x.ham
'neewom'



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1094542&group_id=5470


More information about the Patches mailing list