[Python-Dev] Decimal(unicode)

Oleg Broytmann phd at phd.pp.ru
Tue Mar 25 14:46:17 CET 2008

Hello. In Python 2.5.1 the code

import decimal

for d in '123', u'123':
    x = decimal.Decimal(d)
    print type(x.to_eng_string())


<type 'str'>
<type 'str'>

   In 2.5.2 it prints

<type 'str'>
<type 'unicode'>

   Why the change? Is it a bug or a feature? Shouldn't .to_eng_string()
always return a str?

     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-Dev mailing list