Checking against NULL will be eliminated?
Stefan Behnel
stefan_ml at behnel.de
Wed Mar 2 09:21:13 EST 2011
Claudiu Popa, 02.03.2011 14:51:
> 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?
Let me guess - this is using ElementTree, right?
It's not the idiom itself that changes, it's the Element class in
ElementTree that will likely change its behaviour in later versions.
Fix: do as it says.
Stefan
More information about the Python-list
mailing list