Skip to content

Instantly share code, notes, and snippets.

@fatso83
Created October 30, 2025 11:08
Show Gist options
  • Save fatso83/c8bb58b9acddd2500faace2d43cf6169 to your computer and use it in GitHub Desktop.
Save fatso83/c8bb58b9acddd2500faace2d43cf6169 to your computer and use it in GitHub Desktop.
class Strange:
foo = 10
def inc(self):
self.foo += 1
a = Strange()
b = Strange()
a.inc()
a.inc()
a.inc()
a.inc()
a.inc()
print('a',a.foo)
print('b',b.foo)
Strange.foo = 22
print('a', a.foo)
print('b', b.foo)
b.inc()
b.inc()
c = Strange()
print('a', a.foo)
print('b', b.foo)
print('c', c.foo)
@fatso83
Copy link
Author

fatso83 commented Oct 30, 2025

❯ python test.py
a 15
b 10
a 15
b 22
a 15
b 24
c 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment