Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Make int() and long() fall back to __trunc__(). See issue 2002. | Jeffrey Yasskin | 2008-02-04 | 1 | -2/+0 |
| | |||||
* | Make the Rational constructor accept '3.' and '.2' as well as '3.2'. | Mark Dickinson | 2008-02-02 | 1 | -3/+12 |
| | |||||
* | Roll back r60248. It's useful to encourage users not to change Rational | Jeffrey Yasskin | 2008-02-01 | 1 | -3/+11 |
| | | | | instances. | ||||
* | Minor wordsmithing on docstring | Raymond Hettinger | 2008-01-31 | 1 | -8/+7 |
| | |||||
* | Remove unused to-be-magic methods from Rational per issue 1968. Do not port | Jeffrey Yasskin | 2008-01-31 | 1 | -34/+0 |
| | | | | this patch to py3k. | ||||
* | Added more documentation on how mixed-mode arithmetic should be implemented. I | Jeffrey Yasskin | 2008-01-31 | 1 | -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() because | Jeffrey Yasskin | 2008-01-27 | 1 | -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 nit | Raymond Hettinger | 2008-01-27 | 1 | -1/+1 |
| | |||||
* | Make rational.gcd() public and allow Rational to take decimal strings, per | Jeffrey Yasskin | 2008-01-27 | 1 | -15/+22 |
| | | | | Raymond's advice. | ||||
* | More design notes | Raymond Hettinger | 2008-01-25 | 1 | -0/+4 |
| | |||||
* | Fix-up signature for approximation. | Raymond Hettinger | 2008-01-25 | 1 | -5/+6 |
| | |||||
* | Add one other review comment. | Raymond Hettinger | 2008-01-25 | 1 | -1/+1 |
| | |||||
* | Mark todos and review comments. | Raymond Hettinger | 2008-01-25 | 1 | -0/+13 |
| | |||||
* | Add support for copy, deepcopy, and pickle. | Raymond Hettinger | 2008-01-25 | 1 | -0/+15 |
| | |||||
* | More code cleanup. Remove unnecessary indirection to useless class methods. | Raymond Hettinger | 2008-01-24 | 1 | -15/+15 |
| | |||||
* | Add support for int(r) just like the other numeric classes. | Raymond Hettinger | 2008-01-24 | 1 | -0/+2 |
| | |||||
* | Clean-up and speed-up code by accessing numerator/denominator directly. ↵ | Raymond Hettinger | 2008-01-24 | 1 | -11/+3 |
| | | | | There's no reason to enforce readonliness | ||||
* | Cleanup | Raymond Hettinger | 2008-01-24 | 1 | -3/+1 |
| | |||||
* | Minor clean-up and more tests. | Raymond Hettinger | 2008-01-24 | 1 | -2/+4 |
| | |||||
* | Add first-cut at an approximation function (still needs rounding tweaks). ↵ | Raymond Hettinger | 2008-01-24 | 1 | -0/+36 |
| | | | | Add continued fraction conversions. | ||||
* | Several tweaks: add construction from strings and .from_decimal(), change | Jeffrey Yasskin | 2008-01-19 | 1 | -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 infinite | Jeffrey Yasskin | 2008-01-15 | 1 | -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. |