[Tutor] who makes FOR loop quicker
joel.goldstick at gmail.com
Thu Aug 6 14:57:34 CEST 2015
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
> '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