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/2000-March/002677.html below:

[Python-Dev] re: Using lists as sets

[Python-Dev] re: Using lists as sets [Python-Dev] re: Using lists as setsBarry A. Warsaw bwarsaw@cnri.reston.va.us
Mon, 20 Mar 2000 17:01:00 -0500 (EST)
>>>>> "JH" == Jeremy Hylton <jeremy@cnri.reston.va.us> writes:

    JH> As far as I can tell, the problem is caused by the special way
    JH> that a for loop uses the __getitem__ protocol.  There are two
    JH> related issues that lead to confusion.

>>>>> "MZ" == Moshe Zadka <moshez@math.huji.ac.il> writes:

    MZ> Well, my look is that it is caused by the fact __getitem__ is
    MZ> used both for the sequence protocol and the mapping protocol

Right.

    MZ> Agreed though, that the whole iteration protocol should be
    MZ> revisited -- but that is a subject for another post.

Yup.

    JH> The right solution, I think, is to allow a means for stating
    JH> explicitly whether a class with an __getitem__ method is a
    JH> sequence or a mapping (or both?).

Or should the two protocol use different method names (code breakage!).

    JH> I believe this is where types-vs.-classes meets
    JH> subtyping-vs.-inheritance.

meets protocols-vs.-interfaces.



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