Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!news.le-studio75.com!news.univ-fcomte.fr!not-for-mail From: Laurent Claessens Newsgroups: comp.lang.python Subject: Re: checking if a list is empty Date: Wed, 11 May 2011 13:45:05 +0200 Organization: A poorly-installed InterNetNews site Lines: 22 Message-ID: <4DCA76C1.4040205@gmail.com> References: <9hYwp.5805$xo2.3333@newsfe07.iad> <4dc4b351$0$29991$c3e8da3$5496439d@news.astraweb.com> <4dca6f91$0$29980$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: soleil.univ-fcomte.fr Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.univ-fcomte.fr 1305114301 28798 194.57.84.1 (11 May 2011 11:45:01 GMT) X-Complaints-To: news@news.univ-fcomte.fr NNTP-Posting-Date: Wed, 11 May 2011 11:45:01 +0000 (UTC) To: Steven D'Aprano User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: <4dca6f91$0$29980$c3e8da3$5496439d@news.astraweb.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5106 > I believe you are grossly oversimplifying whatever code you had. Using > the definition of f from above: > >>>> theta = math.pi/4 >>>> f(math.cos(2*theta)) > 6.12303176911e-17 Yes: its oversimplifued. The angle come from a normal vector of a curve and so on.... In particular, I was using Sage; the computations are exact: pi is pi and cos(pi) is zero. >> Conclusion: the boolean value of an object is to be used with care in >> order to tests if an optional parameter is given or not (when default >> value is None). > > Or, to put it another way: if you want to test for an object being None, > test for the object being None. It was my conclusion too ;) Laurent