Is 'everything' a refrence or isn't it?

bonono at gmail.com bonono at gmail.com
Fri Jan 6 05:56:16 EST 2006


Steven D'Aprano wrote:
> But in programming, things do work that way. If my class Book contains a
> reference to Smith's classic work, I can modify it. (Unless the language
> deliberately restricts my ability to modify certain objects, as Python
> does with immutable objects.)
>
> That's what programmers expect when you talk about references, especially
> if they come from a C (or Pascal) background. In Python, sometimes that's
> true, and sometimes it is not, and the only way to tell is by looking at
> the object itself, not by thinking about Python's high-level behaviour.

I believe one can restrict modification to pointer/reference parameter
passing to C function, so C programmer shouldn't have problem knowing
that reference doesn't not necessary mean you can modify it.




More information about the Python-list mailing list