Sturla Molden skrev:
Dag Sverre Seljebotn skrev:
> f(x)
>
>> doesn't ever change the value of x! 
>Only if x is immutable.

This is just wrong -- there's a  fundamental difference of changing which 
reference is stored in a variable in the calling scope, and modifying objects. 
You can change x, but you can't reassing x.

Perhaps my wording could have been clearer.

>> While in C++, f could take a reference. 
>In Python, x is always a reference. But there are immutable types. So 
>while a Python int is immutable, a C or C++ int is mutable.
>
>If you want to enforce immutability even in C++, then make local copies 
>before making the function call.

Yes, of course...

Dag


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to