cpython/Demo/classes
Raymond Hettinger bdaad8c939 * Fix error in definition of Im() which returned self instead of 0
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.
2005-04-09 14:55:07 +00:00
..
Complex.py * Fix error in definition of Im() which returned self instead of 0 2005-04-09 14:55:07 +00:00
Dates.py Replace backticks with repr() or "%r" 2004-02-12 17:35:32 +00:00
Dbm.py Replace backticks with repr() or "%r" 2004-02-12 17:35:32 +00:00
README Update docs. Remove old classes.doc. 2002-10-18 15:40:13 +00:00
Range.py Add code for a range function that uses generators. 2004-06-27 23:17:35 +00:00
Rat.py Run these demo scripts through reindent.py to give them 4-space indents. I've verified that their output is unchanged. 2003-04-24 17:13:18 +00:00
Rev.py SF patch #803449: modernize demo scripts 2003-09-10 21:12:59 +00:00
Vec.py SF patch #803449: modernize demo scripts 2003-09-10 21:12:59 +00:00
bitvec.py Replace backticks with repr() or "%r" 2004-02-12 17:35:32 +00:00

README

Examples of classes that implement special operators (see reference manual):

Complex.py	Complex numbers
Dates.py	Date manipulation package by Tim Peters
Dbm.py		Wrapper around built-in dbm, supporting	arbitrary values
Range.py	Example of a generator: re-implement built-in range()
Rat.py		Rational numbers
Rev.py		Yield the reverse of a sequence
Vec.py		A simple vector class
bitvec.py	A bit-vector class by Jan-Hein B\"uhrman

(For straightforward examples of basic class features, such as use of
methods and inheritance, see the library code.)