Message5810
| Author |
tim.peters |
| Recipients |
| Date |
2001年08月07日.06:55:27 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
The Ref Man doesn't explicitly say anything about
Python's left-to-right evaluation order. Strict left-
to-right was Guido's intent, though, and it comes up a
few times per year on c.l.py (indeed, I was just
replying to a msg asking about it).
The docs should get fleshed out.
There's also a bug:
>>> counter = 0
>>> def i():
... global counter
... counter += 1
... return counter
...
>>> {i(): i()}
{2: 1}
>>> {i(): i(), i(): i()}
{4: 3, 6: 5}
>>>
That is, key:value *pairs* are evaluated left to
right, but within a single key:value pair, the value
gets evaluated first. When I asked Guido about that
some years ago, he agreed it was a bug.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 13:55:38 | admin | link | issue448679 messages |
| 2007年08月23日 13:55:38 | admin | create |
|