summaryrefslogtreecommitdiffstats
path: root/Lib/rational.py
Commit message (Collapse)AuthorAgeFilesLines
* Make int() and long() fall back to __trunc__(). See issue 2002.Jeffrey Yasskin2008-02-041-2/+0
|
* Make the Rational constructor accept '3.' and '.2' as well as '3.2'.Mark Dickinson2008-02-021-3/+12
|
* Roll back r60248. It's useful to encourage users not to change RationalJeffrey Yasskin2008-02-011-3/+11
| | | | instances.
* Minor wordsmithing on docstringRaymond Hettinger2008-01-311-8/+7
|
* Remove unused to-be-magic methods from Rational per issue 1968. Do not portJeffrey Yasskin2008-01-311-34/+0
| | | | this patch to py3k.
* Added more documentation on how mixed-mode arithmetic should be implemented. IJeffrey Yasskin2008-01-311-12/+74
| | | | | also noticed and fixed a bug in Rational's forward operators (they were claiming all instances of numbers.Rational instead of just the concrete types).
* Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() becauseJeffrey Yasskin2008-01-271-55/+1
| | | | | | | it's useful outside of rational numbers. This is my first C code that had to do anything significant. Please be more careful when looking over it.
* Docstring nitRaymond Hettinger2008-01-271-1/+1
|
* Make rational.gcd() public and allow Rational to take decimal strings, perJeffrey Yasskin2008-01-271-15/+22
| | | | Raymond's advice.
* More design notesRaymond Hettinger2008-01-251-0/+4
|
* Fix-up signature for approximation.Raymond Hettinger2008-01-251-5/+6
|
* Add one other review comment.Raymond Hettinger2008-01-251-1/+1
|
* Mark todos and review comments.Raymond Hettinger2008-01-251-0/+13
|
* Add support for copy, deepcopy, and pickle.Raymond Hettinger2008-01-251-0/+15
|
* More code cleanup. Remove unnecessary indirection to useless class methods.Raymond Hettinger2008-01-241-15/+15
|
* Add support for int(r) just like the other numeric classes.Raymond Hettinger2008-01-241-0/+2
|
* Clean-up and speed-up code by accessing numerator/denominator directly. ↵Raymond Hettinger2008-01-241-11/+3
| | | | There's no reason to enforce readonliness
* CleanupRaymond Hettinger2008-01-241-3/+1
|
* Minor clean-up and more tests.Raymond Hettinger2008-01-241-2/+4
|
* Add first-cut at an approximation function (still needs rounding tweaks). ↵Raymond Hettinger2008-01-241-0/+36
| | | | Add continued fraction conversions.
* Several tweaks: add construction from strings and .from_decimal(), changeJeffrey Yasskin2008-01-191-12/+64
| | | | | __init__ to __new__ to enforce immutability, and remove "rational." from repr and the parens from str.
* Add rational.Rational as an implementation of numbers.Rational with infiniteJeffrey Yasskin2008-01-151-0/+410
precision. This has been discussed at http://bugs.python.org/issue1682. It's useful primarily for teaching, but it also demonstrates how to implement a member of the numeric tower, including fallbacks for mixed-mode arithmetic. I expect to write a couple more patches in this area: * Rational.from_decimal() * Rational.trim/approximate() (maybe with different names) * Maybe remove the parentheses from Rational.__str__() * Maybe rename one of the Rational classes * Maybe make Rational('3/2') work.