On Wed, Mar 25, 2015 at 10:44 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Mar 25, 2015 at 8:36 AM, Larry Martell <larry.mart...@gmail.com> > wrote: >> On Wed, Mar 25, 2015 at 8:26 AM, Grant Edwards <invalid@invalid.invalid> >> wrote: >>> On 2015-03-25, Larry Martell <larry.mart...@gmail.com> wrote: >>>> I have an app that works with 2.6, but in 2.7 it is failing. I traced >>>> it down to an issue with decimal.Decimal being passed a value of 0.0. >>>> It 2.6 this is fine, but in 2.7 it throws an exception: >>>> >>>> TypeError: Cannot convert float to Decimal. First convert the float to a >>>> string >>>> >>>> This is easy enough to deal with, but I find it odd. Is this a known issue? >>> >>> $ python >>> Python 2.7.9 (default, Jan 2 2015, 09:51:10) >>> [GCC 4.8.3] on linux2 >>> Type "help", "copyright", "credits" or "license" for more information. >>>>>> import decimal >>>>>> decimal.Decimal(0) >>> Decimal('0') >>>>>> decimal.Decimal(0.0) >>> Decimal('0') >>>>>> decimal.Decimal('0') >> >> I'm sorry, I missed typed. It works in 2.7, but not in 2.6: > > "Changed in version 2.7: The argument to the constructor is now > permitted to be a float instance." > > https://docs.python.org/2/library/decimal.html#decimal.Decimal
Thanks! -- https://mail.python.org/mailman/listinfo/python-list