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

SourceForge.net noreply at sourceforge.net
Mon Jan 10 15:08:38 CET 2005


Patches item #1094542, was opened at 2005-01-02 13:26
Message generated for change (Comment added) made by mcherm
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'



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

>Comment By: Michael Chermside (mcherm)
Date: 2005-01-10 09:08

Message:
Logged In: YES 
user_id=99874

Would someone be willing to provide the motivation for
adding this class? I'm certainly willing to listen, but I'm
not convinced this is worth adding to the std library. (I
guess that's a -0 vote.)

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

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-01-03 12:38

Message:
Logged In: YES 
user_id=1188172

Let me add that the main functionality consists in the easy
initializing and updating (otherwise, you just could use an
empty class).

I'm +1 on the class, but I would call it `bunch'.

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

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