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

Mike Meyer mwm at mired.org
Fri Jan 6 12:04:43 EST 2006


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.

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

>>>> 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.

> 		temp = 'changed'

            <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list