[Python-Dev] (no subject) (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 11 06:17:31 CET 2015
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] PEP 370 - per-user scripts directory on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Donald Stufft wrote:
1. The statement *item is roughly the same thing as (item[0], item[1], item[n])
No, it's not -- that would make it equivalent to tuple(item), which is not what it means in any of its existing usages.
What it is roughly equivalent to is
item[0], item[1], item[n]
i.e. without the parens, whatever that means in the context concerned. In the context of a function call, it has the effect of splicing the sequence in as if you had written each item out as a separate expression.
You do have a valid objection insofar as this currently has no meaning at all in a comprehension, i.e. this is a syntax error:
[item[0], item[1], item[n] for item in items]
So we would be giving a meaning to something that doesn't currently have a meaning, rather than changing an existing meaning, if you see what I mean.
-- Greg
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] PEP 370 - per-user scripts directory on Windows
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]