1 | initial version |
This is a very partial answer, but in a Python crash course (by William Stein I presume, now I can't find the link) I learned this example:
def f(a, L=[]):
L.append(a)
return L
with the following astonishing outputs:
sage: f(2)
[2]
sage: f(5)
[2, 5]
sage: f(4)
[2, 5, 4]
(this is pure Python, Sage is not guilty).
2 | No.2 Revision |
This is a very partial answer, but in a Python crash course (by William Stein I presume, now I can't find the link) I learned this example:
def f(a, L=[]):
L.append(a)
return L
with the following astonishing successive outputs:
sage: f(2)
[2]
sage: f(5)
[2, 5]
sage: f(4)
[2, 5, 4]
(this is pure Python, Sage is not guilty).