Create Data Type
Gerhard Häring
gerhard.haering at opus-gmbh.net
Tue Feb 4 07:45:47 EST 2003
Wezzy <Fabio at est.it> wrote:
> i didn't think to the simplest solution : a class without method!
You might also find the 'Bunch' interesting. It's discussed here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
The definition is very simple:
class Bunch:
def __init__(self, **kwds):
self.__dict__.update(kwds)
Now you can initialize your 'struct' with keyword arguments:
circle = Bunch(x = 10.0, y = 12.0, radius=5.0)
Gerhard
--
Gerhard Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32
http://www.opus-gmbh.net/
More information about the Python-list
mailing list