pytwo.py 635 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. class MyClass(object):
  2. def __init__(self):
  3. self.string = "test string"
  4. @staticmethod
  5. def print_string():
  6. print "hi"
  7. def foo():
  8. return new_my_class()
  9. def fooo(*args, **kwargs):
  10. return "fooo"
  11. # new_my_class = MyClass
  12. # new_my_class.print_string()
  13. # foo().print_string()
  14. # MyClass = fooo
  15. # new_foo = MyClass
  16. # print(new_foo)
  17. # new_my_class = MyClass()
  18. # new_my_class.print_string()
  19. # def my_decorator(dec_str):
  20. # def wrapper(func):
  21. # # print dec_str
  22. # print "before my func"
  23. # func()
  24. # print "after my_func"
  25. # return wrapper
  26. # @my_decorator("to decorator")
  27. # def foo():
  28. # print "my_function"
  29. # foo()