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


Groups > comp.lang.python > #6792

Re: float("nan") in set or as key

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <malaclypse2@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'wed,': 0.03; 'default,': 0.07; 'numeric': 0.07; 'python': 0.08; 'integers': 0.09; 'received :mail-bw0-f46.google.com': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'different,': 0.16; 'floats': 0.16; 'head,': 0.16; 'received:209.85.214.46': 0.16; 'situations,': 0.16; 'subject:key': 0.16; 'subject:set': 0.16; 'url:html)': 0.16; 'have:': 0.19; 'header:In-Reply-To:1': 0.21; 'fixed': 0.27; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'true,': 0.29; 'do.': 0.30; '(both': 0.30; 'carl': 0.30; 'now)': 0.30; 'url:library': 0.31; 'seem': 0.32; 'usually': 0.32; 'to:addr :python-list': 0.33; 'rather': 0.34; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'floating': 0.37; 'url:docs': 0.37; 'pretty': 0.37; 'url:python': 0.38; 'url:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'best': 0.60; 'plus': 0.65; 'ships': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=B8T/BPkrv3iQk0fwG6gZKeRxR9tnD5Cdc/8So4pVST8=; b=hEaO4GxvdhA67XVRaM3T59l0GyDJ12vvoVEC0vpXL1t0mkXmNsG5DCJbJ+a+krJbt+ 9IjftLji0dkT+v5MROih0z1X19CEjHpI4JfJbYwYPeG+RJ6mua4e/3lip7yZzPMJGDa0 m79yrTFLUzQ4TMwbt1xRPK7DhWAj0p7e8BhgQ=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=v6QrCuG4wNOJkzT9H9A0ISr2JRDzGR4BBiGaWmXDmMv63Pia9BdvpVV+gw0YwwkcyZ jgNQJLv/HIdmw3aZgKf1+NL/3OPxBqRWuMJLPjZYlvz99jJtp9b+F4jWNqoP+qNjFaiF ZYlmf7vjTzMvvUZhleAEmAztdqU7oR9xOpang=
MIME-Version 1.0
In-Reply-To <BANLkTik=KzU-Ezx=w77nsEBTsd7Mb9k1CQ@mail.gmail.com>
References <mailman.2351.1306897552.9059.python-list@python.org> <b7b526f5-c839-4b3e-8e00-eee8a19078ce@glegroupsg2000goo.googlegroups.com> <BANLkTik=KzU-Ezx=w77nsEBTsd7Mb9k1CQ@mail.gmail.com>
Date Wed, 1 Jun 2011 09:44:36 -0400
Subject Re: float("nan") in set or as key
From Jerry Hill <malaclypse2@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2358.1306935879.9059.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 82.94.164.166
X-Trace 1306935879 news.xs4all.nl 49046 [::ffff:82.94.164.166]:54244
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6792

Show key headers only | View raw


> On Wed, Jun 1, 2011 at 1:30 PM, Carl Banks <pavlovevidence@gmail.com> wrote:
> True, but why should the "non-integer number" type be floating point
> rather than (say) rational?

You seem to be implying that python only provides a single non-integer
numeric type.  That's not true.  Python ships with a bunch of
different numeric types, including a rational type.  Off the top of my
head, we have:

IEEE floating point numbers
(http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex)
Rationals (http://docs.python.org/library/fractions.html)
Base-10 fixed and floating point numbers
(http://docs.python.org/library/decimal.html)
Complex numbers
(http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex
plus http://docs.python.org/library/cmath.html)
Integers (both ints and longs, which are pretty well unified by now)

Floats have far and away the best performance in most common
situations, so they end up being the default, but if you want to use
something different, it's usually not hard to do.

-- 
Jerry

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: float("nan") in set or as key Carl Banks <pavlovevidence@gmail.com> - 2011-05-31 20:30 -0700
  Re: float("nan") in set or as key Roy Smith <roy@panix.com> - 2011-05-31 23:43 -0400
    Re: float("nan") in set or as key Grant Edwards <invalid@invalid.invalid> - 2011-06-01 14:04 +0000
  Re: float("nan") in set or as key Chris Angelico <rosuav@gmail.com> - 2011-06-01 13:57 +1000
    Re: float("nan") in set or as key Ben Finney <ben+python@benfinney.id.au> - 2011-06-01 15:18 +1000
  Re: float("nan") in set or as key Jerry Hill <malaclypse2@gmail.com> - 2011-06-01 09:44 -0400
  Re: float("nan") in set or as key Chris Angelico <rosuav@gmail.com> - 2011-06-02 02:12 +1000

csiph-web