Le 30/11/2012 22:23, Aaron Meurer a écrit :
It's worth pointing out that Float does the same thing, if you give it a
high enough precision. Try Float(3.2, 100) for example.
To me, it should just work. Yes, we should encourage the use of strings
over float literals, but Rational(float) not working makes it seem as if
the conversion is not supported, which is not true at all.
There are two things that bite us again and again: constructors that do
too much and polymorphic functions resulting from the conglomeration of
several simple functions under the same name. Here, both apply.
So I suggest a more radical change to the constructor: it should only
accept the two-argument form, and "rat = Rational(p, q)" should have the
following post-conditions:
assert isinstance(rat, Rational)
assert rat.p == p
assert rat.q == q
Everything else it currently does should in separate functions or
(class)methods.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.