pre-PEP generic objects
steve at holdenweb.com
Fri Dec 3 13:41:59 CET 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:
>>>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
> 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?
Holden Web LLC +1 800 494 3119
More information about the Python-list