[Python-Dev] slice subscripts for sequences and mappings
Guido van Rossum
guido at python.org
Sat Mar 3 18:58:59 CET 2012
More information about the Python-Dev mailing list
Sat Mar 3 18:58:59 CET 2012
- Previous message: [Python-Dev] slice subscripts for sequences and mappings
- Next message: [Python-Dev] slice subscripts for sequences and mappings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Mar 3, 2012 at 4:20 AM, Antoine Pitrou <solipsis at pitrou.net> wrote: >> I'd expect slice subscripts to be part of the sequence interface, and >> yet they are not. In fact, they are part of the mapping interface. For >> example, the list object has its slice get/set methods assigned to a >> PyMappingMethods struct. So does a bytes object, and pretty much every >> other object that wants to support subscripts. > > It comes from: > http://hg.python.org/cpython/rev/245224d1b8c9 > http://bugs.python.org/issue400998 > > Written by Michael Hudson and reviewed by Guido. > I wonder why this patch chose to add mapping protocol support to tuples > and lists, rather than add a tp_ slot for extended slicing. That's long ago... IIRC it was for binary compatibility -- I didn't want to add an extra slot to the sq struct because it would require recompilation of 3rd party extensions. At the time that was an important concern. -- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-Dev] slice subscripts for sequences and mappings
- Next message: [Python-Dev] slice subscripts for sequences and mappings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list