Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16202

Strange result ffor object to bool

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <zpengxen@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.074
X-Spam-Evidence '*H*': 0.85; '*S*': 0.00; 'subject:object': 0.07; 'properly.': 0.09; 'subject:result': 0.16; 'all,': 0.28; 'message- id:@mail.gmail.com': 0.28; 'print': 0.29; 'to:addr:python-list': 0.34; 'received:209.85.161': 0.36; 'none': 0.37; 'element': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'type': 0.61
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=3KLDdv5GvWGzcYtNNqUETsM2UQ2vKFq0RTCZpK3KNYQ=; b=u9LH0cw2RkeFD7+7qd1cE1XkrKt8Rsrs9ekPz4kBMis8jmd964Hb4gbRmnR3kVTrv0 3RW1Gz77+ATrZ1Zc5NeRQq2LGkTQ2G7cA4HSsSvd6E4tZWv0lN/XHQmT2xsyBvtmBryB CUYibh5bIx4FCPxrgeYQLDrWLwbjk7YroyzXk=
MIME-Version 1.0
Date Fri, 25 Nov 2011 14:52:25 +0800
Subject Strange result ffor object to bool
From ZhouPeng <zpengxen@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3026.1322203948.27778.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322203948 news.xs4all.nl 6910 [2001:888:2000:d::a6]:54421
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16202

Show key headers only | View raw


Hi all,

In my program, I get a listen element by
listen = graphics.find("listen")

print listen is <Element listen at 6afc20>
print type listen is <type 'instance'>
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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Strange result ffor object to bool ZhouPeng <zpengxen@gmail.com> - 2011-11-25 14:52 +0800
  Re: Strange result ffor object to bool Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-25 08:59 +0000

csiph-web