I'm using __init__()
like this in some SQLAlchemy ORM classes that have many parameters (upto 20).
def __init__(self, **kwargs):
for k, v in kwargs.iteritems():
setattr(self, k, v)
Is it "pythonic" to set attributes like this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…