Guest User

Untitled

a guest
May 24th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class Mixin(object):
  2. def __init__(self, *args, **kwargs):
  3. super(Mixin, self).__init__(*args, **kwargs)
  4. print 'yelp!'
  5.  
  6. class Foo(Mixin):
  7. def __init__(self, *args, **kwargs):
  8. self.bla = kwargs.pop('bla')
  9. super(Foo, self).__init__(*args, **kwargs)
  10.  
  11. f = Foo(bla=42)
  12. yelp!
  13. f = Foo(bla=42, bar=23)
  14. Traceback (most recent call last):
  15. File "<stdin>", line 1, in <module>
  16. File "<stdin>", line 4, in __init__
  17. File "<stdin>", line 3, in __init__
  18. TypeError: object.__init__() takes no parameters
Advertisement
Add Comment
Please, Sign In to add comment