[Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread John Doe
To pass by reference or by copy of - that is the question from hamlet. (hamlet - a community of people smaller than a village python3.4-linux64) xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] i = 0 for x in xlist: print(xlist) print(\txlist[%d] = %d % (i, x)) if x%2 == 0 :

Re: [Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 1:25 AM, John Doe z2...@bk.ru wrote: To pass by reference or by copy of - that is the question from hamlet. (hamlet - a community of people smaller than a village python3.4-linux64) xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] i = 0 for x in xlist: print(xlist)

Re: [Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread Joe Jevnik
The iterator is not revaluated, instead, it is constructing a single iterator, in this case a list_iterator. The list_iterator looks at the underyling list to know how to iterate so when you mutate the underlying list, the list_iterator sees that. This does not mee the expression used to generate

Re: [Python-Dev] who must makes FOR loop quicker

2015-08-05 Thread Steven D'Aprano
On Wed, Aug 05, 2015 at 06:25:07PM +0300, John Doe wrote: To pass by reference or by copy of - that is the question from hamlet. (hamlet - a community of people smaller than a village python3.4-linux64) [snip question] John, you have already posted this same question to the tutor list, where