Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Thank You, Alan. This is THE FIRST time, when I've got a pleasure from the opponent. You're maintain status of a thinking human and, as a humble DAOist, I always say THANK YOU, when I talk to such a Man. 'Cause wisdom bring us the beauty. So, what else I can add. Just a little bit. It would

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Can You, please, elaborate this ..Passing in Python is different than in C or other languages... 'Cause as far as I know - default major Python's implementation CPython is written in C. Joel Goldstick 於 08/05/2015 03:44 PM 寫道: On Wed, Aug 5, 2015 at 3:53 AM, John Doe z2...@bk.ru wrote:

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread Joel Goldstick
On Thu, Aug 6, 2015 at 4:34 AM, John Doe z2...@bk.ru wrote: Can You, please, elaborate this ..Passing in Python is different than in C or other languages... I hesitate, because this question is usually the fuel of flaming wars. So in short: C can pass a value or a reference to a value (the

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Well... Try this look. But I'm just a human and can make mistakes.:)) Passing value - allocates stack and creates NEW memory position. Passing reference - makes stack pointer pointing to any position. Dereference - makes stack pointer pointing to any position AND TAKES VALUE. So, You can

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread Alan Gauld
On 06/08/15 14:28, John Doe wrote: Well, I think, both of us understands that any reference isn't about any sort of a language. It's about REGISTER = [ALU, FPU, ...] No thats about the implementation. The language and implemewntation are completely separate. There can be many different

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Well, I think, both of us understands that any reference isn't about any sort of a language. It's about REGISTER = [ALU, FPU, ...] That's why reference inevitable. While You're talking about Python - You're talking ONLY about interpreter for a BYTEcode Alas, CPU don't speak BYTEcode but

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread John Doe
Thank You, Steven. I've already written to Your colleague, so You will can see about. And when I'm saying 'ALLOCATION' I keep in mind the REGISTER, not a glossary or thesaurus. Language is created for us, not for CPU. Do You agree? Passing VALUE is a time-expensive procedure. Python can't

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread Steven D'Aprano
On Thu, Aug 06, 2015 at 11:34:51AM +0300, John Doe wrote: Can You, please, elaborate this ..Passing in Python is different than in C or other languages... Argument passing in Python is: - different to Perl, C, Scala, Algol and Pascal; - the same as Ruby, Lua, Applescript and Javascript; -

Re: [Tutor] who makes FOR loop quicker

2015-08-06 Thread Steven D'Aprano
On Thu, Aug 06, 2015 at 08:57:34AM -0400, Joel Goldstick wrote: On Thu, Aug 6, 2015 at 4:34 AM, John Doe z2...@bk.ru wrote: Can You, please, elaborate this ..Passing in Python is different than in C or other languages... I hesitate, because this question is usually the fuel of flaming

[Tutor] who 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: [Tutor] who makes FOR loop quicker

2015-08-05 Thread Joel Goldstick
On Wed, Aug 5, 2015 at 3:53 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: [Tutor] who makes FOR loop quicker

2015-08-05 Thread Steven D'Aprano
On Wed, Aug 05, 2015 at 10:53:14AM +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) Python *never* uses either pass by reference OR pass by value (copy). Please read this:

Re: [Tutor] who makes FOR loop quicker

2015-08-05 Thread Mark Lawrence
On 05/08/2015 08:53, 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) xlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] i = 0 for x in xlist: print(xlist) print(\txlist[%d] = %d %