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

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Jul 12 18:09:56 CEST 2013


On Fri, Jul 12, 2013 at 11:45 AM, Joshua Landau <joshua at landau.ws> wrote:

> No. Why would we special-case ½? We'd need a ton of code just to
> special-case ½, ¾, ⅛, ¼, ⅜, ⅝, ⅞, etc. We don't need or want to
> special-case any more values.
>


You don't need to special-case every fraction:

>>> import unicodedata
>>> [unicodedata.numeric(c) for c in  ['½', '¾', '⅛', '¼', '⅜', '⅝', '⅞']]
[0.5, 0.75, 0.125, 0.25, 0.375, 0.625, 0.875]

I would actually support the idea for float() to accept whatever
unicodedata.numeric() accepts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130712/4cdd899d/attachment.html>


More information about the Python-ideas mailing list