Copy **kwargs to self?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-03-29T05:21:06Z Indexed on 2010/03/29 5:23 UTC
Read the original article Hit count: 327

Filed under:
|

Given

class ValidationRule:
    def __init__(self, **kwargs):
        # code here

Is there a way that I can define __init__ such that if I were to initialize the class with something like ValidationRule(other='email') then self.other would be "added" to class without having to explicitly name every possible kwarg?

© Stack Overflow or respective owner

Related posts about python

Related posts about syntax