Proposal: Decimal literals in Python.
sgeiger at ncee.net
Fri Oct 26 21:01:33 CEST 2007
D = lambda x: decimal.Decimal(str(x))
Steven D'Aprano wrote:
> On Fri, 26 Oct 2007 19:19:46 +1000, Ben Finney wrote:
>>> Of course we can intruduce a single character function name as an alias
>>> for the Decimal type constructor, but even then we have to use both
>>> parentheses and quotes for each and every decimal constant. We cannot
>>> make it shorter than D("12.34")
>> Nor should we. A function or type name should be short but explicit, and
>> 'Decimal' is about as short as I'd want.
> You don't like str, int, float, list, set, dict, or bool?
> Or for that matter, enum
National Council on Economic Education
sgeiger at ncee.net | 402-438-8958 | http://www.ncee.net
Leading the Campaign for Economic and Financial Literacy
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 288 bytes
Desc: not available
More information about the Python-list