fork download
  1. class Foo:
  2. @staticmethod
  3. def keyErrorOnRed(f, colour):
  4. if colour == "red":
  5. raise KeyError("Better dead than red")
  6. return lambda: f(*args, **kwargs)
  7.  
  8. class Bar(Foo):
  9. @Foo.keyErrorOnRed("red")
  10. def __init__(self, a, b):
  11. self.vars = a, b
  12.  
  13. if __name__ == '__main__':
  14. barObj = Bar('can', 'haz')
Runtime error #stdin #stdout #stderr 0.09s 8832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 8, in <module>
    class Bar(Foo):
  File "prog.py", line 9, in Bar
    @Foo.keyErrorOnRed("red")
TypeError: keyErrorOnRed() takes exactly 2 arguments (1 given)