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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -