A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-March/117335.html below:

[Python-Dev] slice subscripts for sequences and mappings

[Python-Dev] slice subscripts for sequences and mappings [Python-Dev] slice subscripts for sequences and mappingsGreg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 4 22:14:31 CET 2012
Thomas Wouters wrote:

> Why even have separate tp_as_sequence and tp_as_mapping 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
More information about the Python-Dev mailing list

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