Strange result ffor object to bool
Chris Angelico
rosuav at gmail.com
Fri Nov 25 05:42:50 EST 2011
On Fri, Nov 25, 2011 at 9:09 PM, ZhouPeng <zpengxen at gmail.com> wrote:
> Thanks all.
> if not obj: (in python) and if (!obj) {(in c/c++)
>
> / if obj: (in python) and if (obj) {(in c/c++)
>
> Yea, you are right.
> And I got it later, when I run my program in python 2.7.2,
> It complains:
> FutureWarning: The behavior of this method will change in future versions.
> Use specific 'len(elem)' or 'elem is not None' test instead. if not graphics:
Yep, this is exactly what you need to do. Check if 'elem is None' to
see if it's there or not.
Chris Angelico
More information about the Python-list
mailing list