Christopher Barker writes: > So [inf and -inf] are not "readable input, part of Python syntax", > but they are part of the float API.
Thank you for the correction. Aside: help(float) doesn't mention these aspects of the API. I guess that since 1.0 / 0.0 doesn't return float("inf") and 0.0 / 0.0 doesn't return a float("nan"), that's too far into the weeds for help. WDOT? > Is there any guarantee (or even string expectation) that the __str__ for an > object won't change? Nice typo! Yes, there's a strong expectation. doctests, as you pointed out, are a good example. Python may be good for developers who are moving fast and breaking things, but that's partly because (despite frequent complaints to the contrary) we don't move fast and break things most of the time. > As for using unicode symbols for things like float("inf") -- that would be > an inappropriate for the __repr__, but why not __str__ ? Because they're not always available, even in 2020. Also, ∞ is ambiguous; it's used for the ordinal number infinity (IIRC, more precisely denoted ω), the cardinal number infinity, the positive limit of the real line, the antipode of 0 in the complex (Riemannian) sphere, and probably other things. But >>> complex("inf") (inf+0j) Oof. ;-) >>> complex("inf") * 1j (nan+infj) Yikes! This was fun! :-) Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UZM6RFH66ZYV23WVP4OBCVBW3IO2RUEV/ Code of Conduct: http://python.org/psf/codeofconduct/