Donald Stufft wrote:
However [*item for item in ranges] is mapped more to something like this:
result = []
for item in iterable:
result.extend(*item)
Actually it would be
result.extend(item)
But if that bothers you, you could consider the expansion
to be
result = []
for item in iterable:
for item1 in item:
result.append(item)
In other words, the * is shorthand for an extra level
of looping.
and it acts differently than if you
just did *item outside of a list comprehension.
Not sure what you mean by that. It seems closely
analogous to the use of * in a function call to
me.
--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com