On Fri, Nov 25, 2011 at 9:09 PM, ZhouPeng 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
Thanks all.
I am a c/c++ programer before,
So I directly think it is the same roughly between
if not obj: (in python) and if (!obj) {(in c/c++)
/ if obj: (in python) and if (obj) {(in c/c++)
That if obj is not None, 'if obj:' goes true branch, 'if not obj:'
goes false branch,
and I don't need t
ZhouPeng wrote:
> In my program, I get a listen element by
> listen = graphics.find("listen")
>
> print listen is
> print type listen is
> I am sure listen is not None and can be accessed properly.
>
> But print bool(listen) is False
> if not listen is True
bool(listen) is False here means t
On Fri, 25 Nov 2011 14:52:25 +0800, ZhouPeng wrote:
> Hi all,
>
> In my program, I get a listen element by listen =
> graphics.find("listen")
What is a listen element? It is not a standard Python object. What
library is it from?
> print listen is print type listen is 'instance'> I am sure l
On Fri, Nov 25, 2011 at 5:52 PM, ZhouPeng wrote:
> I am sure listen is not None and can be accessed properly.
>
> But print bool(listen) is False
> if not listen is True
Casting something to boolean follows strict rules derived from the
notion that emptiness is false and nonemptiness is true. Fo
Hi all,
In my program, I get a listen element by
listen = graphics.find("listen")
print listen is
print type listen is
I am sure listen is not None and can be accessed properly.
But print bool(listen) is False
if not listen is True
--
Zhou Peng
--
http://mail.python.org/mailman/listinfo/py