Re:WTFPython – Understanding Python through surprising snippets
by h8hawk on Monday December 23, 2019 @03:43PM
(#21867189)
js also doesn't behave as you want:
The same goes with ruby.
[ Parent
| on HN ]
Re:WTFPython – Understanding Python through surprising snippets
by jakear on Monday December 23, 2019 @05:23PM
(#21868024)
You’re sidestepping the problem. The problem is that Python uses the same syntax for variable declaration and variable assignment, and this can lead to unexpected behavior. That’s far from normal in the programming world, making it more unexpected.