(sorry if you receive this twice, my email client got crazy)

>
> > But then Rational(1.2222) == Integer(1)
> > and that is not only ugly but incorrect ...
>
> A solution would be to check if int(p) == p.
>

yeah, that would be a nice solution, but I think that accepting float's as
arguments is inherently a bad idea (that's why we accept strings instead).
It can be handy that Integer(1.0) == Integer(1), but then

>>> int(1.0 + less_than_machine_precission)
1

and with the p = int(p) thing, you cannot tell if you are casting an int or
a float if the float is closer to an int than the machine precision.

On the other hand, I really like the idea of being able to work with
arbitrary types that 'work like integer types' no matter whether they are
python int's or third party types. I then thought that maybe this could be
checked looking for the attribute __mod__, but this of course would be
tricky, because other libraries (or ourselves) could overload the % operator
for other purposes ...

So no one objects, I think the best is to return to the bigining and just
accept as arguments for Rational: Integer, int's and strings ...

Any comments??

Thanks,


>
> Fredrik
>
> >
>


-- 
Fabian, http://fseoane.net/blog/



-- 
Fabian, http://fseoane.net/blog/



-- 
Fabian, http://fseoane.net/blog/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to