]> granicus.if.org Git - python/commit
Generalize list(seq) to work with iterators. This also generalizes list()
authorTim Peters <tim.peters@gmail.com>
Tue, 1 May 2001 20:45:31 +0000 (20:45 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 1 May 2001 20:45:31 +0000 (20:45 +0000)
commitf553f89d45f049e32f5eadc0c78a1e2440745d7a
tree085e1bcc3a073a4faac1e6cf32e88354142b2994
parent47668928e6f02713a1fbd27b434b08b08ca75d1b
Generalize list(seq) to work with iterators.  This also generalizes list()
to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
This is meant to be a model for how other functions of this ilk (max,
filter, etc) can be generalized similarly.  Feel encouraged to grab your
favorite and convert it!
Note some cute consequences:
    list(file) == file.readlines() == list(file.xreadlines())
    list(dict) == dict.keys()
    list(dict.iteritems()) = dict.items()
    list(xrange(i, j, k)) == range(i, j, k)
Lib/test/test_iter.py
Misc/NEWS
Objects/abstract.c