<span class="Apple-style-span" style="border-collapse: collapse; "><div class="Ih2E3d" style="color: rgb(80, 0, 80); ">On Tue, Mar 25, 2008 at 9:46 AM, Oleg Broytmann <<a href="mailto:phd@phd.pp.ru" style="color: rgb(0, 0, 204); ">phd@phd.pp.ru</a>> wrote:<br>
> In 2.5.2 it prints<br>><br>> <type 'str'><br>> <type 'unicode'><br>><br>> Why the change? Is it a bug or a feature? Shouldn't .to_eng_string()<br>> always return a str?<br>
<br></div>I'd call this a bug. The change is an accident, a side-effect of the fact<br>that in 2.5.1 the coefficient (mantissa) of a Decimal was stored as a<br>tuple, and in 2.5.2 it's stored as a string (which greatly improves efficiency).<br>
Clearly in 2.5.2 the mantissa is being stored as a unicode instance in the<br>second case; it should be explicitly coerced to str in Decimal.__new__.<br><br>If others agree that it's a bug, I'll fix it.<br><font color="#888888"><br>
Mark</font></span><br>