Skip to content

Instantly share code, notes, and snippets.

@frutik
Created July 26, 2013 11:33
Show Gist options
  • Save frutik/6088194 to your computer and use it in GitHub Desktop.
Save frutik/6088194 to your computer and use it in GitHub Desktop.
frutik@Andrews-Mac-mini ~/Downloads$ cat a.py
class A(object):
def a(self):
print 'I am a'
frutik@Andrews-Mac-mini ~/Downloads$ cat b.py
class A(object):
def a(self):
print 'not a'
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = __import__('a', globals(), locals(), [], -1)
>>> a.A().a()
I am a
>>> a = __import__('b', globals(), locals(), [], -1)
>>> a.A().a()
I am not a actualy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment