You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In JS there isn't an equivalent of the global statement in Python: in a sense, a variable is automatically put in the global scope when it is not declared, so the following snippet behaves differently when run under Python than under JS:
some_global = None
def get_global():
if some_global:
return some_global
# compute it
some_global = 'foo'
return some_global
Python itself would raise an UnboundLocalError, while pyflakes reports local variable 'some_global' (defined in enclosing scope on line 1) referenced before assignment.
So I wonder whether pj could/should allow me to put a global statement in that function, adding a null-transform for its node type, in other words simply ignoring the declaration. It would be a bonus if it could even check for the existence of those global(s), just to avoid typos...
The text was updated successfully, but these errors were encountered:
One, the fact that when someone uses JavaScripthon he may think that it also does some kind code checking, more than what the Python's parser alone does. It is not... I think that if a this has to be implemented, the scope checking has to be activated with an option like '--enable-scope-checks' on cmdline
In JS there isn't an equivalent of the
global
statement in Python: in a sense, a variable is automatically put in the global scope when it is not declared, so the following snippet behaves differently when run under Python than under JS:Python itself would raise an
UnboundLocalError
, while pyflakes reportslocal variable 'some_global' (defined in enclosing scope on line 1) referenced before assignment
.So I wonder whether
pj
could/should allow me to put aglobal
statement in that function, adding a null-transform for its node type, in other words simply ignoring the declaration. It would be a bonus if it could even check for the existence of those global(s), just to avoid typos...The text was updated successfully, but these errors were encountered: