On Mon, 24 Mar 2008 09:52:21 +, Duncan Booth wrote:
> The method usually recommended is:
>
> best = list(test)
>
> as it has no side effects
In general, you can't assume *anything* in Python has no side effects,
unless you know what sort of object is being operated on. Here's an
example
[EMAIL PROTECTED] wrote:
> Is there a conceptual difference between
> best =test[:]
> and
>best = [x for x in test] ?
> test is a list of real numbers. Had to use the second form to avoid a
> nasty bug
> in a program I am writing. I have to add too that I was using psyco
> in Python 2.5.1.
ernesto:
best = list(test)
may be faster than:
best = [x for x in test]
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list