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


Groups > comp.lang.python > #90375

Re: why would this print 'True'?

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 195.154.70.45
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!nntpfeed.proxad.net!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:would': 0.07; 'false.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '(b,': 0.16; '(lambda': 0.16; 'ifilter': 0.16; 'itertools': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'should': 0.36; 'filter': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'answer.': 0.68; 'repeat': 0.74; 'subject:this': 0.83; "'true'": 0.84; 'received:139': 0.84; 'subject:True': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Neal Becker <ndbecker2@gmail.com>
Subject Re: why would this print 'True'?
Date Mon, 11 May 2015 08:58:43 -0400
References <miq8ko$q6a$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host exa2-in-fw-01-epn.hns.com
User-Agent KNode/4.14.7
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.360.1431349131.12865.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431349131 news.xs4all.nl 2935 [2001:888:2000:d::a6]:34715
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90375

Show key headers only | View raw


Nevermind - I found the answer.  I was trying this in ipython with pylab:

http://stackoverflow.com/questions/7491951/python-builtin-all-with-generators

Neal Becker wrote:

> from itertools import ifilter
> 
> if all (hasattr (b, 'test') for b in ifilter (lambda b: b < 10,
> [1,2,3,4])):
>     print 'True'
> 
> same result using filter instead of ifilter.
> 
> hasattr (b, 'test') where b is 1, 2, 3... should all be False.  So why
> does this print True?
> 
-- 
Those who fail to understand recursion are doomed to repeat it

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


Thread

Re: why would this print 'True'? Neal Becker <ndbecker2@gmail.com> - 2015-05-11 08:58 -0400

csiph-web