Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Feature suggestion -- return if true Date: Mon, 18 Apr 2011 12:25:42 +1200 Lines: 11 Message-ID: <911eo9FbdlU1@mid.individual.net> References: <8abff237-5ccd-4eb6-85c8-cdc9e87520b7@bl1g2000vbb.googlegroups.com> <90v871FkuaU1@mid.individual.net> <4daaa8a0$0$29986$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net dnVFe1a+siuqmuObpWJRiwDp2JpbEUout0ffAYaDWRIaY3c20o Cancel-Lock: sha1:hgpGYhH16Vg+TDOkaPw80HDPdLE= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: <4daaa8a0$0$29986$c3e8da3$5496439d@news.astraweb.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3442 Steven D'Aprano wrote: > I'm sure you realise that that snippet needlessly recalculates any cached > result that happens to be false, but others reading might not. I only use it as written when I'm dealing with types that don't have false values. If I did need to cache such a type, I would use a different test, such as 'if y is None'. -- Greg