John Machin wrote: > Perhaps a better analogy is that the OP has observed (correctly IMHO) > that the robes of *all* Pythonistas, including those not yet born and > those not yet converted from heathen languages, could be whiter than > what they are. There are others whose capability to implement an > enhancement is likely to be much greater than his.
I love Python, but every time I get an out-of-range error message, I wonder why it didn't just tell me what the out-of-range index was and what the allowable range was. Certainly that information must be available to the exception handler, or how would it know that it is out of range? And no, it's not a big deal, maybe it's even trivial, but after about the 100th time I finally decided to suggest that it be fixed. I started with comp.lang.python because I had no idea whether this issue had been dealt with already, but I am certainly willing to file a feature request if necessary. > Would the following be acceptable, BTW? > > | >>> [4, 5, 6][10] > | IndexError: list index 10 out of range(3) > | >>> [4, 5, 6][-4] > | IndexError: list index -4 out of range(3) That seems fine to me. > Footnote: Based on 2.4.3 source, quite a few files, many with multiple > lines to patch: Holy cow! I can't believe that many changes would be necessary unless the IndexError exception is scattered all over the place. I would hope that one well-placed change could fix the bulk of cases. Oh, and thanks for bringing your attention to this matter. This is one of those little issues that comes up so often that I think fixing it could make a significant difference in the overall efficiency of Python programming. -- http://mail.python.org/mailman/listinfo/python-list