Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; 'subject:two': 0.07; '"> In-Reply-To: <20140329173655.4022d715@bigbox.christie.dr> Date: Sat, 29 Mar 2014 18:41:03 -0400 References: <0245aca0-c6b7-493a-aa52-2c3ef6462dbd@googlegroups.com> <5337195f$0$29994$c3e8da3$5496439d@news.astraweb.com> <20140329173655.4022d715@bigbox.christie.dr> To: Tim Chase X-Mailer: Apple Mail (2.1283) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 110 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396132871 news.xs4all.nl 2949 [2001:888:2000:d::a6]:40577 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69351 --Apple-Mail=_B66256B2-CD61-4433-BAD2-37B3E5BBCA21 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Mar 29, 2014, at 6:36 PM, Tim Chase wrote: > And for cases where you have more than one or two things to test for > None-itude, you could use > > if all(x is None for x in [a, b, c, d]): > do_something_if_theyre_all_None() I might have written that as: if set([a, b, c, d]) == set(None) That's even clearer if you happen to already have the items in an iterable: if set(conditions) == set(None) -- Roy Smith roy@panix.com --Apple-Mail=_B66256B2-CD61-4433-BAD2-37B3E5BBCA21 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
And for cases = where you have more than one or two things to test for
None-itude, = you could use

 if all(x is None for x in [a, b, c, = d]):
   do_something_if_theyre_all_None()

I might have written that = as:

if set([a, b, c, d]) =3D=3D = set(None)

That's even clearer if you happen to = already have the items in an iterable:

if = set(conditions) =3D=3D set(None)


--
Roy = Smith

=


= --Apple-Mail=_B66256B2-CD61-4433-BAD2-37B3E5BBCA21--