nonlocal fails ?
R.Wieser
address at not.available
Thu Nov 14 16:16:13 EST 2019
Michael,
> I note that you didn't answer the question, what are you trying
> to accomplish?
I think I did - though implicitily. What do normal people use "by
reference" arguments for ? Yep, that is what I wanted too.
> It looks to me like you're trying to write a program in a different
> language here, not Python.
I'm trying to learn how Python works, and for that I (ofcourse) compare it
to other languages. What-and-how it does something different (or equal!)
in regard to them.
>Although come to that I can't think of very many reasons to do
> what you propose in any language.
I made propositions to its functioning ? And I was thinking that I just
pointed out oddities in it ...
> If you mentioned what problem you are trying to solve
1) Have value
2) use value in procedure 1
3) use updated value in procedure 2
4) use again updated value in procedure 1, 2 or maybe 3
For the sake of learning I'm now going over all of the possibilities to see
if and how they work. For that I've already excluded globals and the
practice of feeding the value as an argument to the procedure and than store
its result as the new one. I've also excluded using a class object and put
the code in there, as well as faking a "by reference" passing by using a
tuple. "nonlocal" looked to be another option, but it appears to be rather
limited in its application.
In short, the /ways to the goal/ are (currently) important to me, not the
goal itself (I'm sure that apart from the "nonlocal" one all of the above
are viable, and I thus can get /something/ to work)
Yeah, I'm weird like that. Sorry.
Regards,
Rudy Wieser
More information about the Python-list
mailing list