Guido van Rossum wrote: > On 2/9/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > BTW do you also still want to turn ZeroDivisionError into a warning > (that is changed into an error by default)? That idea shared a slide > and I believe it was discussed in the same meeting you & I and some > others had in San Mateo last summer.
I think that idea has some support, but I haven't been thinking about it for awhile. > > > Shouldn't this slot be in the PyNumberMethods extension? It feels more > like a property of numbers than of a property of sequences. Also, the > slot name should then probably be nb_index. Yes, definitely!!! > > There's also an ambiguity when using simple indexing. When writing > x[i] where x is a sequence and i an object that isn't int or long but > implements __index__, I think i.__index__() should be used rather than > bailing out. I suspect that you didn't think of this because you've > already special-cased this in your code -- when a non-integer is > passed, the mapping API is used (mp_subscript). This is done to > suppose extended slicing. The built-in sequences (list, str, unicode, > tuple for sure, probably more) that implement mp_subscript should > probe for nb_index before giving up. The generic code in > PyObject_GetItem should also check for nb_index before giving up. > I agree. These should also be changed. I'll change the PEP, too. > > I think all sequence objects that implement mp_subscript should > probably be modified according to the lines I sketched above. > True. > > This is very close to acceptance. I think I'd like to see the patch > developed and submitted to SF (and assigned to me) prior to > acceptance. > O.K. I'll work on it. -Travis _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com