On 04 dec 2008 at 10:56 AM, Raymond Hettinger <python@rcn.com> wrote:
But at least it will be more usable to have a short-hand for decimal declaration:
a = 1234.5678d
How often do you put non-integer constants in real programs?
A few times indeed (except for strings). So why we are allowing floats literals?
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?
The same happens with any kind of application: except for very common cases (like using integers and strings), constant definitions are rare. But working with financial applications, using decimal numerics is a very common practice. Even if implementation is slow, we prefer exact results over speed: there must be no possibility on failing calculations when we are manipulating moneys. If you take a look at other languages / IDEs, like Delphi or CBuilder, there's support for BCD-like type, but I never appreciated the need to import its library to use it on my applications. Also keep in mind that having the possibility to define literals for a set of types can help a lot in generating a more optimized bytecode. That's because we can do a more aggressive static analysis (a field were can be done a lot of work to improve the performance of the language). Cheers Cesare