Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class foo:
- def __init__(self, **kwargs):
- if 'a' in kwargs:
- self.a = kwargs['a']
- else:
- self.a = 0
- class bar(foo):
- def __init__(self, **kwargs):
- super().__init__()
- if 'x' in kwargs:
- self.x = kwargs['x']
- else:
- self.x = 23
- # b and y are undefined, but my classes use kwargs - what is the best practice for validating / parsing dynamic arguments?
- test = bar(b=1,y=24)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement