|
|
|
|
|
by LeafStorm
5367 days ago
|
|
try:
my_var
except NameError:
pass
else:
if my_var is not None:
# Ted needs better examples
...
When would you EVER need to use this code? There is no situation in which you should ever need to use a variable in Python that may or may not be defined. While Ted's example may seem like a cheap shot, it does highlight an important problem with JavaScript: all the craziness with regards to types that aren't "real" types like undefined, arguments, and Array. |
|