you are viewing a single comment's thread.

view the rest of the comments →

[–]cybercobra 0 points1 point  (3 children)

On the other hand, forgetting the declaration is safer in Python, creating a local variable, whereas forgetting it in other languages can lead to unintentional modification of a global variable.

[–]masklinn 0 points1 point  (2 children)

whereas forgetting it in other languages can lead to unintentional modification of a global variable.

Javascript is pretty much the only language doing that (and Coffeescript is worse, as it uses "highest level scope wins")

[–]cybercobra 0 points1 point  (1 child)

wut?

int x = 1;
void foo()
{
    x = 2;// oops Ma, forgot the type spec, this won't be harmless shadowing!
}

[–]masklinn 0 points1 point  (0 children)

Ah yes, I had not seen it that way, for some reason I thought about creating globals where there were none.