And more to the point, how do I avoid it?
See the link below for further reference; specifically the reply by paxdiablo. How do I check if a variable exists?
As you probably guessed, I have a scenario where I've programmed a web page that has a variable whose existence is unknown at run time.
What is happening is, a user uploads information that can be in several different formats. To be more concrete, an address. For example, the street may have a directional (southwest, north), and the address may have a condo qualifier (unit#2F). These (or things/scenarios like them) will be assigned to and represented by different variables. As the data is manipulated in my code, I have conditionals
if street_dir_var:
#do something
Hence my question(s): why is this bad form, and whats a proper substitute?
PS - if it matters, I'm coding in Python