[Python-ideas] float('∞')=float('inf')

Alexander Belopolsky alexander.belopolsky at gmail.com
Sat Jul 13 00:20:25 CEST 2013


On Fri, Jul 12, 2013 at 5:55 PM, Joshua Landau <joshua at landau.ws> wrote:

> Au contraire, if you accept ½ you are bound by law to accept all of the
> other fractions -- that's much more code than just allowing ∞.


Let's see:

def float(x):
     if x == '\u221e':
           return builtins.float('inf')
     return builtins.float(x)

def float(x):
      if len(x) == 1:
           return unicodedata.numeric(x)
      return builtins.float(x)

Where is "much more code "?

And if you accept '∞', aren't you "bound by law to accept '+∞' and '-∞' as
well?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130712/845e2851/attachment-0001.html>


More information about the Python-ideas mailing list