Re:Anti-Patterns in Python Programming
by zo1 on Wednesday July 09, 2014 @03:31PM
(#8011762)
The expression presented in the parameter list is only evaluated once, and that is when the method is defined. The confusion is that people assume the expression is evaluated every time the method is called.
[ Parent
| on HN ]
The confusion is that people assume the expression is evaluated every time the method is called.
Because that's how it works in a lot of other languages, such as Ruby and Javascript.
I doubt that's the only reason. I fell for it myself at first without ever seeing a line of Ruby. It initially feels intuitive, and that's why I think most fall for it.