greg <[EMAIL PROTECTED]> writes:

> none wrote:
>>     IIRC, I once saw an explanation how Python doesn't have
>> "variables" in the sense that, say, C does, and instead has bindings
>> from names to objects.
>
> If you're talking to C programmers, just tell them that Python
> variables always contain pointers. That should give them the right
> mental model to build on.

That is a convenient shortcut when it works, but in my experience it
tends to confuse the issue.  The reason is that one of the main uses
of pointers in C is implementing pass-by-reference.  A C programmer
told that Python variables internally hold pointers expects this code:

def func(a):
  a = 10
...
func(x)

to change the value of x.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to