Last active
August 29, 2015 14:23
-
-
Save amjith/21144932ee66a13ec150 to your computer and use it in GitHub Desktop.
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
# Part of a package named foo. | |
__all__ = [] | |
def export(defn): | |
"""Decorator to explicitly mark functions that are exposed in a lib.""" | |
globals()[defn.__name__] = defn | |
__all__.append(defn.__name__) | |
return defn | |
from . import foo |
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
# Part of a package named foo. | |
# How can I expose this variable TIMING_ENABLED when someone imports this package? | |
TIMING_ENABLED = True | |
class Foo(object): | |
def set_foo(self, val): | |
self.val = val | |
# How about this one? | |
foo = Foo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment