Skip to content

Instantly share code, notes, and snippets.

@shigin
Created May 5, 2010 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigin/390884 to your computer and use it in GitHub Desktop.
Save shigin/390884 to your computer and use it in GitHub Desktop.
def all_import(module_name, into):
"""The simple 'from module_name import *' function.
Usage:
all_import('os', globals())
all_import('os', locals())
"""
module = __import__(module_name)
names = getattr(module, '__all__', dir(module))
for name in names:
into[name] = getattr(module, name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment