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

Joshua Landau joshua at landau.ws
Mon Jul 15 08:44:14 CEST 2013


On 15 July 2013 00:43, Steven D'Aprano <steve at pearwood.info> wrote:
> On 14/07/13 21:18, Joshua Landau wrote:
>>
>> On 14 July 2013 12:07, Philipp A. <flying-sheep at web.de> wrote:
>
>
>>> float('inf') still works, so if your keyboard layout/compose key doesn’t
>>> support ∞, you just use the ascii variant.
>>
>>
>> That would make the code inconsistent.
>
>
> Who cares if in one function you say float('∞') and in another function you
> say float('inf') and in a third you say float("inf") [note quotation marks]
> and in a fourth float("INF")? What possible difference does it make?

No, I was saying using "∞" here and "float('inf')" there is
inconsistent. If you really want a pretty global-ish constant, you
should just write "Infinity = float('inf')"¹² and forget these
troubling unicode urges. I even tend to use "thing is Ellipses"
instead of "thing is ..." because it reads better -- "thing == ∞" just
goes back to that. Can you really prefer it that much to "thing ==
Infinity"²?

¹ You might wonder what I'm doing with capitalisation, but Ellipsis is
capitalised and its class is lower-case, so I feel this is warranted.

² Or your name of choice


More information about the Python-ideas mailing list