Sujet : Re: "A diagram of C23 basic types"
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 19. Apr 2025, 01:16:55
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vtuq1n$496v$7@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Pan/0.162 (Pokrosvk)
On Fri, 18 Apr 2025 12:49:56 +0100, bart wrote:
The idea behind writing 1e12 for example was for something that was
compact, quick to type, and easy to grasp. This:
int(decimal.Decimal("1e24"))
seems to lack all of those.
I would agree with that. But remember, it can be abbreviated†:
D = decimal.Decimal
then you can just change the above expression to
int(D("1e24"))
I suppose this is why C++ has introduced user-defined literals. No doubt
the Python folks will find some way to provide something similar at some
point ...
†Why is “abbreviated” such a long word?