Reputation
206
Top tag
Next privilege 250 Rep.
View close votes
Badges
1 1
Newest
 Yearling
Impact
~3k people reached

  • 0 posts edited
  • 0 helpful flags
  • 0 votes cast
Dec
30
awarded  Yearling
Jul
19
comment Python mutable default argument: Why?
The thing about the least surprise here is this: if you have the evaluate-on-every-call semantics, you can get an error if the closure changes between two function calls (which is quite possible). This can be more surprising as opposed to knowing that it is evaluated once. Of course, one can argue that when you come from other languages, you except evaluate-on-each-call semantics and that is the surprise, but you can see how it goes both ways :)
Jul
19
awarded  Teacher
Jul
19
answered Python mutable default argument: Why?