summaryrefslogtreecommitdiffstats
path: root/Demo/classes
Commit message (Collapse)AuthorAgeFilesLines
* #2503 make singletons compared with "is" not == or !=Benjamin Peterson2008-03-291-1/+1
| | | | Thanks to Wummel for the patch
* Remove reference to RationalMark Dickinson2008-02-101-1/+0
|
* 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.
* Normalized a few cases of whitespace in function declarations.Martin Blais2006-06-061-35/+35
| | | | | | | | | | | | Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.)
* * Fix error in definition of Im() which returned self instead of 0Raymond Hettinger2005-04-091-19/+14
| | | | | | | | | | | | | | | | for non-complex arguments. * Replace type() comparisons with isinstance() checks. * Replace apply() calls with equivalent syntactic form. * Simplify __hash__ definition to hash the underlying tuple. * Use math.hypot() for more robust computation of __abs__(). * Use sorted() instead of the multi-step keys/sort/iter. * Update comment on the cmath module.
* Patch #1177597: Correct various bugs, add comments.Martin v. Löwis2005-04-091-9/+36
|
* Add code for a range function that uses generators.Brett Cannon2004-06-271-42/+64
| | | | | | | | | Cleaned up existing code by abstracting code to parse arguments. Also removed any unneeded operations (such as calling 'int' on a division when using floor division also works). Fixed a bug where the values returned by OldStyleRange could be short by one value. Added more documentation. Testing code also has a basic sanity check.
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-125-35/+36
| | | | From SF patch #852334.
* SF patch #803449: modernize demo scriptsRaymond Hettinger2003-09-102-93/+89
| | | | (Contributed by George Yoshida.)
* Patch #748846: Let Demo/classes/Date.py mention DateTime module.Martin v. Löwis2003-06-071-0/+3
|
* Run these demo scripts through reindent.py to give them 4-space indents. ↵Andrew M. Kuchling2003-04-247-963/+963
| | | | 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
|
* Update docs. Remove old classes.doc.Guido van Rossum2002-10-182-112/+1
|
* Correct spelling of length, discovered by Christian Tismer.Guido van Rossum1999-04-211-2/+2
|
* nannified.Guido van Rossum1998-09-141-70/+70
|
* 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.)
* Fix the test for pow() -- no more TypeErrors are raised!Guido van Rossum1997-12-091-2/+2
|
* A completely new Rat.py by Sjoerd.Guido van Rossum1997-05-131-56/+260
|
* Added note about Python's support of complex numbers.Guido van Rossum1996-07-301-1/+11
| | | | Added exp(z).
* adapted to new overloading schemeGuido van Rossum1994-10-092-60/+51
|
* totally redone for new overloading schemeGuido van Rossum1994-10-081-60/+263
|
* Use time.time() instead of time.millitimer()Guido van Rossum1994-02-171-5/+5
|
* builtin -> __builtin__Guido van Rossum1994-01-261-2/+2
|
* *** empty log message ***Guido van Rossum1993-12-178-49/+51
|
* Added Dates.py and Rev.pyGuido van Rossum1993-10-301-0/+2
|
* Initial revisionGuido van Rossum1993-10-302-0/+322
|
* Fix bug and use __init__Guido van Rossum1993-10-301-9/+4
|
* *** empty log message ***Guido van Rossum1993-10-271-0/+1
|
* Add coercionsGuido van Rossum1993-10-271-2/+12
|
* Initial revisionGuido van Rossum1993-10-271-0/+341
|
* Initial revisionGuido van Rossum1992-08-137-0/+488