scared about refrences...
Diez B. Roggisch
deets at nospam.web.de
Wed Nov 1 15:32:07 EST 2006
SpreadTooThin schrieb:
> Bruno Desthuilliers wrote:
>> Nick Vatamaniuc a écrit :
>> (snip)
>>> In Python all the primitives are copied and all other entities are
>>> references.
>> Plain wrong. There's no "primitives" (ie : primitive data types) in
>> Python, only objects. And they all get passed the same way.
>
> so..
> def fn(x):
> x = x + 1
> print x
>
> a = 2
> fn(a)
> fn(2)
>
> Wouldn't you say that this is being passed by value rather than by
> refrence?
It appears so, but it still is a truth - all objects, even the numbers,
are objects. No copying.
Diez
More information about the Python-list
mailing list