[Tutor] assign all parameters of __init__ to class variables?
cwitts at compuscan.co.za
Wed Nov 2 14:44:49 CET 2011
On 2011/11/02 03:15 PM, Alex Hall wrote:
> Hi all,
> 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?
def __init__(self, param1, param2, param2, **kw):
I do prefer assignment by hand, just feels nicer especially when looking
at it in the future.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor