[issue39416] Document default numeric string formats
New submission from Karl O. Pinc
Change by Karl O. Pinc
Eric V. Smith
Karl O. Pinc
Eric V. Smith
added the comment: Is the lack of this documentation causing some confusion somewhere? This isn't rhetorical, I'm genuinely curious what problem you're trying to solve.
I'd say no, there's no real confusion anywhere. This started with a search for documentation on Python's default string representation for float. This accidentally wound up on the python-dev mailing list and became a more general discussion during which I suggested that some fundamentals are clear. This is pretty much just a follow-up to that discussion.
Is there any mainstream programming language where the basics of what you've laid out aren't true? It all seems pretty obvious to me. For example, I can't see anyone looking at this and saying "Ah, base 10. That's why it's producing the output I'm seeing."
Well, I just got done looking at YAML which has a lot of base-related
syntax including base 60. :)
The problem that would be solved is that it's easy to rely
on the default Numeric output formats. Most output probably
does not go through a formatter, although this may change
now that f-strings are so easy. Anyway, this would guarantee
"normal output" for numbers, even when switching between
Python implementations.
Likewise, immutability of value when round-tripping through a
string is also obvious. But is still an important property.
So if these properties are important then include them in the spec.
That's what specs are for. (I could probably find some non-mainstream
languages (scheme perhaps) that have specs which include
similar documentation. You pretty have to have a formatter
in compiled languages, so those won't specify a default.
Anyway, it shouldn't matter what other language specs do.)
I understand if nobody sees this as a real problem. And
I don't want to stand up as a big proponent. I'll
point out the argument here and let others decide.
Regards,
Karl
miss-islington
Change by miss-islington
Change by miss-islington
miss-islington
miss-islington
Éric Araujo
Change by Karl O. Pinc
miss-islington
Change by miss-islington
Change by miss-islington
miss-islington
Éric Araujo
participants (4)
-
Eric V. Smith
-
Karl O. Pinc
-
miss-islington
-
Éric Araujo