How to sort a list? NOT a newbie question.
Michael James Barber
mjbarber at ascc.artsci.wustl.edu
Tue Sep 18 05:44:51 EDT 2001
More information about the Python-list mailing list
Tue Sep 18 05:44:51 EDT 2001
- Previous message (by thread): How to sort a list? NOT a newbie question.
- Next message (by thread): How to sort a list? NOT a newbie question.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <mailman.1000747640.16457.python-list at python.org>, Ken Seehof <kseehof at neuralintegrator.com> wrote: > >Finally, there is the practical argument: Michael has given an example >of useful sorting of complex numbers. To counter this, someone must >show an example of a realistic hypothetical bug where a programmer >accidentally sorts or compares complex numbers with devastating >results which would have been avoided if an exception had been >raised. > I'd be interested to hear about such examples, too. This was the behavior in Python 1.5, so possibly there are real examples, not just hypothetical ones? >All experienced programmers know this: > importance(consistency) > importance(sensibility) > >Is there a PEP for this? I couldn't find one. It doesn't seem to be part >of 228, though obviously it would be a requirement for 228. If nobody >responds to me that a PEP already exists, I'll make one. > Take a look at PEP 207 for something related. Given rich comparisons, the most consistent and correct approach is, arguably, to eliminate comparisons of different types (except, presumably, int and float?). PEP 209, concerning revisions to Numeric, is also relevant. I suspect that most people using complex numbers also tend to use Numeric, so the most sensible approach may be to have different sorting behavior for lists and multiarrays. Clashes with the inequality above, though. If you decide to write a PEP, I am willing to help. At this point, I am not certain what the right behavior is, but I do think it is worth getting the rationale shown. I also think it is relevant for 228, which I see as very important. -- Michael J. Barber
- Previous message (by thread): How to sort a list? NOT a newbie question.
- Next message (by thread): How to sort a list? NOT a newbie question.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list