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.
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 :=.
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.