On Apr 26, 1:19 am, Chris Rebert <c...@rebertia.com> wrote: > Apparently either you and the General Decimal Arithmetic spec differ > on what constitutes engineering notation, there's a bug in the Python > decimal library, or you're hitting some obscure part of the spec's > definition. snip > The spec:http://speleotrove.com/decimal/decarith.pdf > (to-engineering-string is on page 20 if you're interested)
Thanks for that. I didn't realize that Mike Cowlishaw wrote the spec we're discussing. It's too bad OS/2 didn't fare better, or we'd possibly be discussing a proposal for a REP (Rexx Enhancement Proposal) ;-) >From that document it appears that my decimal.Decimal(1234567) example shows that the module has a bug: Doc says: [0,123,3] ===> "123E+3" But Python does: >>> import decimal >>> decimal.Decimal(123000).to_eng_string() '123000' Regardless, given that the whole point of format specifiers (whether they are the traditional python 2.x/C style %[whatever] strings, or the new format() function) is to make it easy for you to format numbers for printing, wouldn't the language be better off if we added engineering notation to the features that already offer scientific notation? --Keith Brafford -- http://mail.python.org/mailman/listinfo/python-list