Checking against NULL will be eliminated?

Claudiu Popa cpopa at bitdefender.com
Wed Mar 2 08:51:30 EST 2011


Hello Python-list,


I  don't  know how to call it, but the following Python 3.2 code seems to raise a
FutureWarning.

def func(root=None):
    nonlocal arg
    if root:
       arg += 1
The  warning is "FutureWarning: The behavior of this method will change
in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead."
Why is the reason for this idiom to be changed?

  

-- 
-- 
Claudiu Popa




More information about the Python-list mailing list