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


Groups > comp.lang.python > #90373

why would this print 'True'?

From Neal Becker <ndbecker2@gmail.com>
Subject why would this print 'True'?
Date 2015-05-11 08:51 -0400
Newsgroups comp.lang.python
Message-ID <mailman.357.1431348710.12865.python-list@python.org> (permalink)

Show all headers | View raw


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

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

csiph-web