Nested function scope problem
Bruno Desthuilliers
onurb at xiludom.gro
Mon Jul 31 06:21:28 EDT 2006
Antoon Pardon wrote:
> On 2006-07-29, Gerhard Fiedler <gelists at gmail.com> wrote:
>> On 2006-07-29 13:47:37, Antoon Pardon wrote:
>>
>>> I think the important thing to remember is that the assignment in Python
>>> is a alias maker and not a copy maker. In languages like C, Fortran,
>>> pascal, the assignment makes a copy from what is on the righthand and
>>> stores that in the variable on the lefthand. In languages like Lisp,
>>> Smalltalk and Python, the assignment essentially makes the lefthand
>>> an alias for the righthand.
>> Yes, I think I got it now :)
>>
>> It seems that, in essence, Bruno is right in that Python doesn't really
>> have variables. Everything that seems variable doesn't really change; what
>> changes is that an element of what seems to change gets rebound.
>
> Aren't you looking too much at implementation details now?
>
> The difference between an alias assignment and a storage assigment
> is for instance totaly irrelevant for immutable objects/values like numbers.
# Python
a = 42
b = a
del a
# C
int *a, *b;
a = malloc(sizeof *a);
*a = 42;
b = a;
free(a);
I wouldn't say it's "totally" irrelevant.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list