Guest User

Untitled

a guest
Jun 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. ClassName.StaticMethod ( )
  2.  
  3. class MyClass(object):
  4. @staticmethod
  5. def the_static_method(x):
  6. print x
  7.  
  8. MyClass.the_static_method(2) # outputs 2
  9.  
  10. class C:
  11. @staticmethod
  12. def f(arg1, arg2, ...): ...
  13.  
  14. >>> class C:
  15. ... @staticmethod
  16. ... def hello():
  17. ... print "Hello World"
  18. ...
  19. >>> C.hello()
  20. Hello World
Add Comment
Please, Sign In to add comment