[ZODB-Dev] Schema definition
Paolo Losi
paolo at linux.netline.it
Tue Feb 1 13:40:06 EST 2005
I'm back again :-)
stop me if you think you had enough :-)
I'm defining complex objects (lots of attributes).
Instead of using the standard approach:
class Test:
def __init__(self, a1=None, a2="Default Value):
self.a1 = a1
self.a2 = a2
I'm thinking of:
Class Test:
a1 = None
a2 = "Default"
def __init__(self,**kargs):
for attribute in kargs.keys():
setattr(self,attribute,kargs[attribute])
This allows me to avoid writing the same attribute name three times :-)
Do you see any drawbacks? Does there exist a common practice for schema
definition? Does there exist a "zodb best practices" document?
Thanks again and ciao
Paolo
More information about the ZODB-Dev
mailing list