[Python-ideas] Decimal literal?

Cesare Di Mauro cesare.dimauro at a-tono.com
Thu Dec 4 11:22:12 CET 2008

On Thu, Dec 4, 2008 at 11:10 AM, Chris Rebert <clp at rebertia.com> wrote:

>> How often do you put non-integer constants in real programs?
>> Don't you find that most real decimal apps start with external
>> data sources instead of all the data values being hard-coded
>> in your program?
> In all fairness, by that same argument we shouldn't have float
> literals, yet we do despite that. They're useful in scripts where
> things are hardcoded. Later, the scripts grow and we do end up reading
> the numbers in from external sources. That doesn't mean the initial
> script version wasn't useful. Literals help when writing
> proofs-of-concept and rapid prototypes, areas where Python has
> historically done well.
> Java's designers probably used similar arguments against hard-coding
> when deciding not to include collection literals; meanwhile Python
> does have such literals and they appear to be much cherished as
> language features go. The parallels to the decimal situation are
> striking.
> Having decimal literals as well would at least keep things consistent.
> Sets are less common, yet they now have literals; why not decimals
> too?
> Cheers,
> Chris

I absolutely agree. Literals, also, can help improve language speed.


More information about the Python-ideas mailing list