どういうany = lambda v: v
意味ですか?それ自体v
だけのようですv
。
class Object(object):
"""Common base class supporting automatic kwargs->attributes handling,
and cloning."""
attrs = ()
def __init__(self, *args, **kwargs):
any = lambda v: v
for name, type_ in self.attrs:
value = kwargs.get(name)
if value is not None:
setattr(self, name, (type_ or any)(value))
else:
try:
getattr(self, name)
except AttributeError:
setattr(self, name, None)