News for hackers. Stuff that matters.
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:

  var a = 9;   
  function foo() {
      console.log(a);
      var a = 12;
  }
  foo();

  $node foo.js
  undefined
The same goes with ruby.
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.
Re:WTFPython – Understanding Python through surprising snippets by xscott on Monday December 23, 2019 @04:09PM (#21867399)
JavaScript is far from perfect, but at least it's clear you declared two variables.