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 -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -