Code in Python Blog
Showing posts with label
mutable type
.
Show all posts
Showing posts with label
mutable type
.
Show all posts
Tuesday, February 2, 2016
Tricky questions: function parameters with default mutable values
Today I discovered one confusing feature of Python. And also decided to open new category on my blog, which will be called "tricky python questions".
def append(num, to=[]): to.append(num) return to aa = append(1) print aa bb = append(2) print bb
Read more »
Older Posts
Home
Subscribe to:
Posts (Atom)