[Python-Dev] slice subscripts for sequences and mappings (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 4 22:14:31 CET 2012
- Previous message: [Python-Dev] slice subscripts for sequences and mappings
- Next message: [Python-Dev] cpython compilation error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thomas Wouters wrote:
Why even have separate tpassequence and tpasmapping anymore? That particular distinction never existed for Python types, so why should it exist for C types at all? I forget if there was ever a real point to it,
I imagine the original motivation was to provide a fast path for types that take ints as indexes. Also, it dates from the very beginnings of Python, before it had user defined classes. At that time the archetypal sequence (list) and the archetypal mapping (dict) were very distinct -- I don't think dicts supported 'in' then, so there was no overlap. It looks like a case of "it seemed like a good idea at the time".
The distinction broke down fairly soon after, but it's so embedded in the extension module API that it's been very hard to get rid of.
-- Greg
- Previous message: [Python-Dev] slice subscripts for sequences and mappings
- Next message: [Python-Dev] cpython compilation error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]