Skip to content

Instantly share code, notes, and snippets.

@amjith
Last active August 29, 2015 14:23
Show Gist options
  • Save amjith/21144932ee66a13ec150 to your computer and use it in GitHub Desktop.
Save amjith/21144932ee66a13ec150 to your computer and use it in GitHub Desktop.
# 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
# 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