pre-PEP generic objects

Paul Rubin http
Thu Dec 2 20:25:09 EST 2004


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.



More information about the Python-list mailing list