[Python-ideas] Decimal literal?

Aahz aahz at pythoncraft.com
Thu Dec 4 14:35:38 CET 2008

On Thu, Dec 04, 2008, Raymond Hettinger wrote:
> One other thought, decimal literals are likely  not very helpful in real 
> programs. Most apps that have specific numeric requirements, will have 
> code that manipulates numbers read-in from external sources and written 
> back out -- the scripts themselves typically contain very few constants 
> (and those are typically integers), so you don't get much help from a 
> decimal literal.

That's half-true.  Most applications IME that manipulate numbers need to
express zero frequently as initializers.  So yeah, it's easy to just
write things like::

    total = dzero
    balance = dzero

but I think there's definitely some utility from writing::

    total = 0.0d
    balance = 0.0d

How much utility (especially from the readability side) is of course
subject to debate, but please don't ignore it altogether.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan

More information about the Python-ideas mailing list