Got bitten by this so many times

RT @OliverCaldwell@twitter.com

I'm no Python expert, but is this a super common bug? How do people use defaults without this happening?

def x (y=[]):
return y

x() => []
x().append(10)
x() => [10]

🐦🔗: twitter.com/OliverCaldwell/sta

literally watch me write:

def x(y=lambda: []):
return y

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!