nonlocal fails ?

Pieter van Oostrum pieter-l at vanoostrum.org
Fri Nov 15 03:59:52 EST 2019


"R.Wieser" <address at not.available> writes:

> Jan,
>
>> So what you want to do is dynamic scope?
>
> No, not really.    I was looking for method to let one procedure share a 
> variable with its caller - or callers, selectable by me.   And as a "by 
> reference" argument does not seem to exist in Python ...
>
> And yes, I am a ware that procedures can return multiple results.  I just 
> didn'want to go that way (using the same variable twice in a single 
> calling).

Do you mean, if Proc1() is called from Func1, it uses MyVar defined in Func1, and if it is called from Func2, it uses MyVar from Func2?

If that is what you mean, that would be dynamic scope.
-- 
Pieter van Oostrum <piet-l at vanoostrum.org>
WWW: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]


More information about the Python-list mailing list