[Dan Bishop]
#- * Binary operators with one Rational operand and one float or Decimal
#- operand will not raise a TypeError, but return a float or Decimal.
I think this is a mistake. Rational should never interact with float.
#- * Expressions of the form Decimal op Rational do not work. This is a
#- bug in the decimal module.
Can you tell me where? (or submit a bug in SF). Thanks.
#- * The constructor only accepts ints and longs. Conversions
#- from float
#- or Decimal to Rational can be made with the static methods:
#- - fromExactFloat: exact conversion from float to Rational
What ExactFloat means to you? For example, what should Rational.fromExactFloat(1.1) should return?
And we starting here the same long discussion that lead decimal to not be created from float because it never would be clear what it will do.
#- - fromExactDecimal: exact conversion from Decimal to Rational
Rational already is created from strings like "2.33", so use str() over the Decimal, not a special method:
>>> import decimal
>>> decimal.Decimal("3.44")
Decimal("3.44")
>>> str(decimal.Decimal("3.44"))
'3.44'
>>> import rational
>>> rational.Rational(str(decimal.Decimal("3.44")))
Rational("344 / 100")
>>>
. Facundo
Bit�cora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ADVERTENCIA.
La informaci�n contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener informaci�n confidencial o propietaria, cuya divulgaci�n es sancionada por la ley.
Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no est� autorizado a divulgar, copiar, distribuir o retener informaci�n (o parte de ella) contenida en este mensaje. Por favor notif�quenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magn�tico) que pueda haber realizado del mismo.
Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telef�nica Comunicaciones Personales S.A. o alguna empresa asociada.
Los mensajes electr�nicos pueden ser alterados, motivo por el cual Telef�nica Comunicaciones Personales S.A. no aceptar� ninguna obligaci�n cualquiera sea el resultante de este mensaje.
Muchas Gracias.
-- http://mail.python.org/mailman/listinfo/python-list
