[Home]History of Insertion sort/Talk

HomePage | Recent Changes | Preferences

Revision 2 . . December 16, 2001 6:48 am by Carey Evans [note on simplifying Python "pseudo-code"]
Revision 1 . . December 11, 2001 5:25 pm by Hannes Hirzel [Question about sample implementation]
  

Difference (from prior major revision) (no other diffs)

Changed: 1c1,11
Question: Which language is the example implementation written in?
Question: Which language is the example implementation written in?

The example is written in Python.
I'm planning on simplifying it a bit, in particular to remove the cmp function being passed as a parameter:

*A built-in function cmp() already exists, and means something different (-ve if a<b, 0 if a=b, +ve if a>b);
*IMO, Python's lambda notation and default arguments are not appropriate for near pseudo-code;
*"a > b" is much better for trying to understand an algorithm than a function call.
*Custom Python types can define their own comparisons anyway, so a comparator parameter is unnecessary.

--Carey Evans

HomePage | Recent Changes | Preferences
Search: