Last active
August 29, 2015 14:10
-
-
Save BlackVegetable/2a1aac52ad5b02f9e03c 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
# This is module A | |
colton_salary = 900000 | |
def print_hello(): | |
print "hello" | |
class Employee: | |
def __init__(self): | |
self.salary = colton_salary - 5000 | |
# This is module B | |
import A | |
employee = A.Employee() | |
# This is crashing because colton_salary isn't defined!? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns out this doesn't crash as written. I was using variable names that began with
__
which conflicted with python's name mangling. (I was using it for name mangling too. I've since switched to another form of name mangling that doesn't conflict.)