Guest User

Untitled

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