Skip to content

Instantly share code, notes, and snippets.

@audiodude
Created January 5, 2024 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audiodude/01d6f14777d80d28cbb5aa2af7726de0 to your computer and use it in GitHub Desktop.
Save audiodude/01d6f14777d80d28cbb5aa2af7726de0 to your computer and use it in GitHub Desktop.
class Fruit:
def __init__(self, name):
self.name = name
apple = Fruit('apple')
apples = {
'apple': apple,
'red apple': apple,
'a': apple,
}
apples['a'].name = 'banana'
print(list(a.name for a in apples.values()))
#
# => ['banana', 'banana', 'banana']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment