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

Ernst Noch enoch at gmx.net
Fri Jan 6 12:39:55 EST 2006


Mike Meyer wrote:
> Ernst Noch <enoch at gmx.net> writes:
> 
>>Maybe next time showing something like the following trivial snippet
>>might help demonstrate that the core of the matter doesn't is not the
>>way python treats parameters?
> 
> 
> Did you insert an extra "doesn't" in that? If so, then I agree about
> what isn't the core of the matter.

Uhm, yes. Seems the whole message was written too hastily.

> 
> On the other hand, the snippet doesn't help without an
> explanation. Especially with misleading comments.

Absolutely, it was mainly meant as an example to demonstrate in practice 
that the way python passes parameters has nothing to do with what happens.

> 
> 
>>>>>def func(param, what):
>>
>>	if what:
>>		param['foo'] = 'changed'
>>	else:
>>		temp = param['foo'] # temp is _not_ a reference!
> 
> 
> Except temp *is* a reference. What it's not is a reference to
> param['foo']. Instead, it's a reference to the same object that
> param['foo'] is a reference to.
> 

Oh dear, yes. I inserted that comment as an afterthought.







More information about the Python-list mailing list