Created
September 6, 2021 12:27
-
-
Save RyanKor/a4ffcfc2d9af07d76b7d3e8e66db0bc1 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
class Gizmo: | |
def __init__(self): | |
print("Gizmo id: %d" % id(self)) | |
x = Gizmo() | |
# Gizmo id : 4301489152 | |
y = Gizmo() * 10 | |
# Gizmo id : 4301489432 | |
''' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: unsupported operand type(s) for *: 'Gizmo' and 'int' | |
>>> dir() | |
['Gizmo', ..., 'x'] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment