Anonymous user
Multiple distinct objects: Difference between revisions
m
→{{header|Python}}
(added python) |
|||
Line 33:
=={{header|Python}}==
The mistake is often written as:
<code python>[Foo()] * n # here Foo() can be any expression that returns
which is incorrect since <code>Foo()</code> is only evaluated once. A common correct version is:
<code python>[Foo() for i in xrange(n)]</code>
|