Created
July 12, 2017 11:31
-
-
Save mkroutikov/176f24ed2ced4129c1618a9f21af1f5d to your computer and use it in GitHub Desktop.
Lazy-loading domain map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DomainMap: | |
_domain_map = None | |
@classmethod | |
def _get(cls): | |
# do heavy lifting here | |
# result = ... | |
return result | |
@classmethod | |
def get(cls): | |
if cls._domain_map is None: | |
cls._domain_map = cls._get() | |
return cls._domain_map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment