>>> def getid():
... print "in getid"
... return uuid.uuid1()
...
>>> class test(object):
... def __init__(self, id = getid()):
... self.id = id
...
in getid
>>>
>>> a = test()
>>>
>>> a.id
UUID('f20f40b2-5e8a-11df-be97-001f161eed5b')
>>>
>>> b = test()
>>>
>>> b.id
UUID('f20f40b2-5e8a-11df-be97-001f161eed5b')
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment