Guest User

Untitled

a guest
Jun 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. >>> import __builtin__
  2. >>> __builtin__.rubbish= 3
  3. >>> rubbish
  4. 3
  5.  
  6. from mypackage.constants import *
  7.  
  8. class Config:
  9. """
  10. Borg singlton config object
  11. """
  12. __we_are_one = {}
  13. __myvalue = ""
  14.  
  15. def __init__(self):
  16. #implement the borg patter (we are one)
  17. self.__dict__ = self.__we_are_one
  18.  
  19. def myvalue(self, value=None):
  20. if value:
  21. self.__myvalue = value
  22. return self.__myvalue
  23.  
  24. conf = Config()
  25. conf.myvalue("Hello")
  26. conf2 = Config()
  27. print conf2.myvalue()
  28.  
  29. import superglobal
  30. superglobal.whatever = loacalWhatever
  31. other = superglobal.other
Add Comment
Please, Sign In to add comment