News for hackers. Stuff that matters.
Re:The scope of index variables in Python's for loops by Animats on Sunday January 18, 2015 @03:04PM (#8908639)
One problem with implicit declaration is that it's sometimes hard to decide whether some construct should create a new variable or not. Python's basic rule, that everything has function scope, was at least simple. I'm surprised that was changed for list comprehensions.

Go has worse problems. The ":=" operator in Go indicates the creation of a new variable. Except when there are multiple variables on the left side of the :=.

   a, b := 1,2
can declare a, b, or a and b, but not neither of a and b. (See https://play.golang.org/p/zE7AIMhleo). This can create some hard to find shadowing bugs.

Declaration-free language are hard. It's impressive how far Python got without declarations. Now there's an advisory typing proposal for Python. It's not a very good proposal; some of the type info goes in comments because it didn't fit the syntax.

Re:The scope of index variables in Python's for loops by aroberge on Sunday January 18, 2015 @07:54PM (#8909710)
> It's not a very good proposal; some of the type info goes in comments because it didn't fit the syntax.

Actually, the reason why it is put in the comments is that it is implemented as an experimental feature so that its usefulness can be evaluated without having to (possibly only temporarily) change the syntax.