A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-January/012380.html below:

[Python-Dev] Re: Sets: elt in dict, lst.include

[Python-Dev] Re: Sets: elt in dict, lst.include - really begs for a PEPBarry A. Warsaw barry@digicool.com
Wed, 31 Jan 2001 11:50:10 -0500
>>>>> "MZ" == Moshe Zadka <moshez@zadka.site.co.il> writes:

    MZ> Basic response: I *love* the iter(), sq_iter and __iter__
    MZ> parts.  I tremble at seeing the rest.  Why not add a method to
    MZ> dictionaries .iteritems() and do

    | for (k, v) in dict.iteritems():
    | 	pass

    MZ> (dict.iteritems() would return an an iterator to the items)

Moshe, I had exactly the same reaction and exactly the same idea.  I'm
a strong -1 on introducing new syntax for this when new methods can
handle it in a much more readable way (IMO).

Another idea would be to allow the iterator() method to take an
argument:

    for key in dict.iterator()

a.k.a.

    for key in dict.iterator(KEYS)

and also

    for value in dict.iterator(VALUES)
    for key, value in dict.iterator(ITEMS)

One problem is that the constants KEYS, VALUES, and ITEMS would either
have to be defined some place, or you'd just use values like 0, 1, 2,
which is less readable perhaps than just having iteratoritems(),
iteratorkeys(), and iteratorvalues() methods.  Alternative spellings:

    itemsiter(), keysiter(), valsiter()
    itemsiterator(), keysiterator(), valuesiterator()
    iiterator(), kiterator(), viterator()

ad-nauseum-ly y'rs,
-Barry



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