summaryrefslogtreecommitdiffstats
path: root/Demo/classes/Rat.py
Commit message (Collapse)AuthorAgeFilesLines
* Add rational.Rational as an implementation of numbers.Rational with infiniteJeffrey Yasskin2008-01-151-310/+0
| | | | | | | | | | | | | 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.
* Run these demo scripts through reindent.py to give them 4-space indents. ↵Andrew M. Kuchling2003-04-241-279/+279
| | | | I've verified that their output is unchanged.
* Modernize code by using isinstance() instead of type() checksAndrew M. Kuchling2003-04-241-16/+14
|
* Avoid TypeError by not comparing complex numbersAndrew M. Kuchling2003-04-241-1/+6
|
* Fix a bug where comparison of a rational with a float failed becauseGuido van Rossum1998-09-091-9/+9
| | | | | | | the difference got converted to float. Put brackets around the string representation of (non-integer) rationals. (Sjoerd Mullender.)
* A completely new Rat.py by Sjoerd.Guido van Rossum1997-05-131-56/+260
|
* adapted to new overloading schemeGuido van Rossum1994-10-091-21/+27
|
* *** empty log message ***Guido van Rossum1993-12-171-5/+6
|
* Add coercionsGuido van Rossum1993-10-271-2/+12
|
* Initial revisionGuido van Rossum1992-08-131-0/+86