[Tutor] who makes FOR loop quicker
z2911 at bk.ru
Thu Aug 6 15:28:47 CEST 2015
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 BITcode.
So, Python can't allocate memory for CPU only for interpreter, which
will ask allocation through underlying-C-language.
Do I wrong?
CPU have compiler for Python?
As well as multithreading, for instance, in Python goes to a single
interpreter, but in C - to multiple cores of CPU. So Python doesn't have
REAL multithreading, but C - does.
And in my case by means of C-rules Python allocates FOR-loop's list as a
reference. And that mistake wastes each iteration of FOR-loop in
unnecessary RE-evaluation of initial-list IN LOGIC STATEMENT, which must
be created only once. Any INITIATIONS make once. 'Cause it sucks
Does this point make sense for You?
Joel Goldstick 於 08/06/2015 03:57 PM 寫道:
> On Thu, Aug 6, 2015 at 4:34 AM, John Doe <z2911 at 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 address of the place
> in memory where the value is stored)
> Python passes an object -- everything in python is an object. If the
> object is mutable, and the function mutates it, those results will be
> seen outside the function. If the object is immutable, and the
> function tries to change its value, a new object is created with the
> new value. Its name is the name given in the parameter list -- not
> the name that the function was called with. When the function
> completes, that object is lost since the outer scoped named object
> wasn't changed.
>> 'Cause as far as I know - default major Python's implementation CPython is
>> written in C.
> What language is used for its implementation has nothing to do with
> its own specification.
More information about the Tutor