Fredrik Lundh wrote:
(snip)
>
> variable = None
>
> ... lots of code that may assign to variable ...
>
> if variable is not None:
> print "not defined"
Shouldn't that be:
if variable is None:
print "not defined"
?-)
Note to the OP: if None is a valid value for the variable, you may use
another object, ie:
def somefunc(*args, **kw):
variable = _marker = object()
(...)
if variable is _marker:
print "not defined"
(...)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list