Generic utility class for passing data
Robert Kern
robert.kern at gmail.com
Sat Oct 29 00:53:42 EDT 2005
bonono at gmail.com wrote:
> just curious, since python don't care what object is being passing
> around and the receiving function has to 'decode' it(be it tuple or
> dict or whatever). What is the advantage of dummy class ?
The convenience of the attribute notation.
For the record, my favorite variation is as follows:
class Bunch(dict):
def __init__(self, *args, **kwds):
dict.__init__(self, *args, **kwds)
self.__dict__ = self
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list