Any way to catch potentially undefined variables in Python? -
although enjoy working python, i'm big fan languages enforce variable declaration before use, because catches silly spelling mistakes in variables before code run.
is there utility can scan python files , warn if thinks variable potentially undeclared?
there no pure python utility know of can perform function want. however, dynamic variable declaration can used part of program flow the try...except
structure:
if some_input: = 5 try: print except nameerror: do_something
Comments
Post a Comment