Skip to content

Instantly share code, notes, and snippets.

@terapyon
Created November 13, 2017 02:53
Show Gist options
  • Save terapyon/3bae7264f2246b5a3022d359cc349bd9 to your computer and use it in GitHub Desktop.
Save terapyon/3bae7264f2246b5a3022d359cc349bd9 to your computer and use it in GitHub Desktop.
import b
class A:
def __init__(self, save_dir):
self.save_dir = save_dir
save_dialog = A(b.prefs.get('save_dir'))
def show():
pass
import a
class B:
def get(self, name):
pass
prefs = B()
a.show()
$ python3
Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/terapyon/tmp/effective/b.py", line 1, in <module>
import a
File "/Users/terapyon/tmp/effective/a.py", line 7, in <module>
save_dialog = A(b.prefs.get('save_dir'))
AttributeError: module 'b' has no attribute 'prefs'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment