Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # a.py
- import b
- print 'my name:', __name__
- class classproperty(object):
- def __init__(self, f):
- self.f = f
- def __get__(self, obj, owner):
- return self.f(owner)
- print 1
- class settings:
- root_path = 'root'
- local_path = ''
- platform = 'pc'
- version = '1.2.7'
- @classproperty
- def path(self):
- return self.root_path + self.platform + self.version + self.local_path
- print 2, id(settings)
- if __name__ == "__main__":
- print 5
- settings.version = "2"
- settings.root_path = "____"
- print("called from a: %s" % settings.version)
- b.process()
- #b.py
- import a
- print 3, id(a.settings)
- class settings(a.settings):
- local_path = 'local'
- print 4
- def process():
- print("called from b: %s" % settings.version)
- print(settings.path)
Advertisement
Add Comment
Please, Sign In to add comment