Alex Hall wrote: > I have a class which takes a large number of optional arguments for > its __init__. Instead of going through every single one and assigning > it to "self.[name]", is there some quick way to take all the > parameters of the constructor and assign them all to self.[name] in > one step?
You could use something like http://code.activestate.com/recipes/280381-clean-up-__init__-methods-that- contain-only-attrib/ or def __init__(self, **kw): self.__dict__.update(kw) but I'd recommend against it. I've never used the recipe myself and instead try hard to keep argument list sizes managable. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor