Python: default argument blunders

A few minutes ago a friend sent me the following code, and told me its misbehaving: def foo(l=[]): l.append(“hello!”) print(l) foo() foo() Instead of printing [“hello”] twice, it printed [“hello”, “hello”]. Any ideas why? what’s going on? I’ll… Read more

Similar

Python on iOS

This post was originally published hereThis holiday I discovered Pythonista, and my mind was blown. In the iOS world, Pythonista is a well known quantity. I can find articles about it from sources like MacStories from back in 2012. Back then it was fairly...

Read more »