Guest User

Untitled

a guest
Feb 18th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. # a.py
  2. import b
  3.  
  4. print 'my name:', __name__
  5.  
  6. class classproperty(object):
  7. def __init__(self, f):
  8. self.f = f
  9. def __get__(self, obj, owner):
  10. return self.f(owner)
  11.  
  12. print 1
  13. class settings:
  14. root_path = 'root'
  15. local_path = ''
  16. platform = 'pc'
  17. version = '1.2.7'
  18.  
  19. @classproperty
  20. def path(self):
  21. return self.root_path + self.platform + self.version + self.local_path
  22.  
  23. print 2, id(settings)
  24.  
  25.  
  26. if __name__ == "__main__":
  27. print 5
  28. settings.version = "2"
  29. settings.root_path = "____"
  30. print("called from a: %s" % settings.version)
  31. b.process()
  32.  
  33. #b.py
  34. import a
  35.  
  36. print 3, id(a.settings)
  37. class settings(a.settings):
  38. local_path = 'local'
  39.  
  40. print 4
  41.  
  42. def process():
  43. print("called from b: %s" % settings.version)
  44. print(settings.path)
Advertisement
Add Comment
Please, Sign In to add comment