Last active
May 26, 2016 09:15
-
-
Save njdart/80959df1be8556480322bee708b4520e 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
import uuid | |
class Foo(): | |
def __init__(self, id=uuid.uuid4()): | |
self.id = id | |
class Bar(): | |
def __init__(self, id=uuid.uuid4()): | |
self.id = id | |
class Works(): | |
def __init__(self, id=None): | |
self.id = id if id is not None else uuid.uuid4() | |
if __name__ == "__main__": | |
foo_one = Foo() | |
foo_two = Foo() | |
bar_one = Bar() | |
bar_two = Bar() | |
works_one = Works() | |
works_two = Works() | |
# Makes a new Id for the first, but not the second | |
print("Foo 1", foo_one.id) | |
print("Foo 2", foo_two.id) | |
# Makes a new Id for the first, thats different from Foo's id, but not the second | |
print("Bar 1", bar_one.id) | |
print("Bar 2", bar_two.id) | |
# both works_one and works_two are different ids | |
print("Works 1", works_one.id) | |
print("Works 2", works_two.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow, that's pretty messed up. Have you reported this?