E. Madison Bray wrote:
So I might want to check:

finite_definite = True
for it in my_map.iters:
    try:
        len(it)
    except TypeError:
        finite_definite = False

if finite_definite:
    my_seq = list(my_map)
else:
    # some other algorithm

If map is being passed into your function, you can still do this
check before calling map.

If the user is doing the mapping themselves, then in Python 2 it
would have blown up anyway before your function even got called,
so nothing is any worse.

--
Greg


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to