pre-PEP generic objects

Istvan Albert ialbert at mailblocks.com
Thu Dec 2 17:23:47 EST 2004


Steven Bethard wrote:

> I promised I'd put together a PEP for a 'generic object' data type for 
> Python 2.5 that allows one to replace __getitem__ style access with 
> dotted-attribute style access (without declaring another class).  Any 
> comments would be appreciated!

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.

Istvan.



More information about the Python-list mailing list