Why does unpacking this map object print "must be an iterable, not map"?

Viewed 1181

What is going on here?

>>> list(map(lambda *x: x, *map(None, 'abc')))
Traceback (most recent call last):
  File "<pyshell#52>", line 1, in <module>
    list(map(lambda *x: x, *map(None, 'abc')))
TypeError: type object argument after * must be an iterable, not map

Ignore the senselessness of the code. This is about the error message, "iterable, not map". Maps are iterables, are they not?

And if I only replace None with str, the whole thing works fine:

>>> list(map(lambda *x: x, *map(str, 'abc')))
[('a', 'b', 'c')]

So now Python doesn't have any issue with a map there after all.

This happens in my Python 3.6.1. My Python 3.5.2 instead raises the expected TypeError: 'NoneType' object is not callable. And googling "must be an iterable, not map" finds no results at all. So apparently this is something introduced just recently.

Is this just a Python bug? Or is there some sense to this?

Update: Reported as bug now, as suggested.

1 Answers
Related