Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!shaftesbury.zen.co.uk.POSTED!not-for-mail From: Nobody Subject: Re: float("nan") in set or as key Date: Sat, 04 Jun 2011 20:29:45 +0100 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.python References: <94dkd3F7k4U1@mid.individual.net> <4de1e3e7$0$2195$742ec2ed@news.sonic.net> <4de22007$0$29996$c3e8da3$5496439d@news.astraweb.com> <4de2d746$0$29996$c3e8da3$5496439d@news.astraweb.com> <4de75dd5$0$29983$c3e8da3$5496439d@news.astraweb.com> <2350f7e6-474f-455d-8c97-6a758de63179@p9g2000prh.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lines: 16 Organization: Zen Internet NNTP-Posting-Host: 9d6029ca.news.zen.co.uk X-Trace: DXC=7G7BO2;G]DJA:hgOd\?Y> If you're "fluent" in IEEE-754, then you won't find its behaviour >> unexpected. OTOH, if you are approach the issue without preconceptions, >> you're likely to notice that you effectively have one exception mechanism >> for floating-point and another for everything else. > > Three actually: None, nan and exceptions None isn't really an exception; at least, it shouldn't be used like that. Exceptions are for conditions which are in some sense "exceptional". Cases like dict.get() returning None when the key isn't found are meant for the situation where the key not existing is unexceptional. If you "expect" the key to exist, you'd use dict[key] instead (and get an exception if it doesn't).