On Fri, 18 Feb 2005 13:28:34 -0800, Guido van Rossum <gvanrossum at gmail.com> wrote: > > Would it be possible to change > > > > _PyEval_SliceIndex in ceval.c > > > > so that rather than throwing an error if the indexing object is not an > > integer, the code first checks to see if the object has a > > tp_as_number->nb_int method and calls it instead. > > I don't think this is the right solution; since float has that method, > it would allow floats to be used as slice indices, but that's not > supposed to work (to protect yourself against irreproducible results > due to rounding errors). I wonder if floats are the special case here, not "integer like objects". I've never been particularly happy about the confusion between the two roles of int() and it's C equivalents, i.e. casting and conversion.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4