daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class foo:
  2.   def __init__(self, **kwargs):
  3.     if 'a' in kwargs:
  4.       self.a = kwargs['a']
  5.     else:
  6.       self.a = 0
  7.  
  8. class bar(foo):
  9.   def __init__(self, **kwargs):
  10.     super().__init__()
  11.     if 'x' in kwargs:
  12.       self.x = kwargs['x']
  13.     else:
  14.       self.x = 23
  15.  
  16. # b and y are undefined, but my classes use kwargs - what is the best practice for validating / parsing dynamic arguments?
  17. test = bar(b=1,y=24)
RAW Paste Data
Top