differentmatt / filbert

JavaScript parser of Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mutable default arguments don't mutate

dzhang314 opened this issue · comments

def foo(xs=[]):
    xs.append(5)
    return xs

self.say(foo()) # produces "[]"; correct output is "[5]"
self.say(foo()) # produces "[]"; correct output is "[5, 5]"
self.say(foo()) # produces "[]"; correct output is "[5, 5, 5]"

Now produces Atempted to invoke bookmark for [Function] @basicer