pre-PEP generic objects

Steve Holden steve at holdenweb.com
Fri Dec 3 07:41:59 EST 2004


Paul Rubin wrote:

> Steven Bethard <steven.bethard at gmail.com> writes:
> 
>>>IMHO this too easy to accomplish right now to warrant
>>>an "official" implementation:
>>>class Bunch:
>>>    pass
>>>b = Bunch()
>>>b.one, b.two, b.three = 1,2,3
>>>works just fine, depending on the problem I might add a few special
>>>operators. For anything more complicated I'd rather write a real class.
>>
>>...
>>The belief that I gathered from the end of the previous thread
>>discussing this (check last week's python-list I think) was that there
>>were a significant number of people who had wanted a class like this
>>(notably IPython), and more than one of them had rewritten the class a
>>few times.
> 
> 
> I've written that class more than a few times myself, and ended up
> adding operations to print the objects (show the member values),
> serialize them (don't output any member whose name starts with _), etc.
> 
> I think it would be worthwhile to standardize something like this.

For this reason a PEP would have value: if it's rejected, the reasons 
for its rejection will be recorded for posterity. If it isn't rejected, 
of course, we get a bunch as part of the included batteries.

Next question: bunch is a cute name, but not very suggestive of purpose. 
Who can think of a better one?

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list