On Fri, Mar 7, 2014 at 12:52 PM, Andrew Barnert email@example.com wrote:
From: Chris Angelico firstname.lastname@example.org
Sent: Thursday, March 6, 2014 4:29 PM
So... I'm +1 for adding a literal syntax for decimals. +1 for adding a stating-the-default for floats (do it straight away, then code that uses it can be backported all the way even when there's a change of default).
This makes sense if you also add an optional suffix for binary floats at the same time. Otherwise, it would be confusing to talk about the "default" when there's no way to make it explicit, and it would delay any potential change of the default by at least one version, if not more.
Of course there's a lot of room for bikeshedding the suffix. The "f" suffix from C implies 32-bit float as opposed to 64-bit double, which is obviously wrong. The "d" suffix from C might be confusing as distinguishing "binary, not decimal". Maybe "b"?
Yep. That's what I mean (when I said "float"s up there, I meant the current type 'float', aka binary floating point). The suffix won't have any effect; it'll be like u"string" in Py3, explicitly stating the default, and added for the exact same reason.
+0.5 for adding a syntax for fractions; support in principle but the devil's in the details.
What details, other than bikeshedding the exact suffix? If 3r == fraction.Fraction(3), we're done, right?
Precisely that detail. Is it 3r? 3F? Something else? Would it look tidier as a prefix instead of a suffix? But if that can be resolved, it'd be good to have a syntax for fractions.
I'm only +0.5 on that, as rationals aren't as big an advantage over the status quo as decimal is. It's a lot less common to see:
Fraction(1/3) Fraction(6004799503160661, 18014398509481984)
than the oddities of decimal.Decimal construction that we're seeing here. Having a numeric suffix for decimal literals will be much more beneficial to the language, imo; if the bikeshedding of Fraction literals is problematic, I'd not be against doing decimal (and binary float) tags one version, and leaving Fraction for another version. ('Course, it might all work out perfectly, in which case great! Add 'em all at once.)