[Python-ideas] Re: [new idea] dynamic return with using function argument

2019-08-26 Thread HUANG YUWEI
that it is unworthy and namedtuple or a class could solve the problem. Thanks for all your kind explanation. Let us close this conversation. Huang Y.W Greg Ewing 于2019年8月27日周二 上午8:01写道: > HUANG YUWEI wrote: > > the number of return variables could be many. Then it would look like > > ``` >

[Python-ideas] Re: [new idea] dynamic return with using function argument

2019-08-26 Thread HUANG YUWEI
ou are right that the initial value of the variable at the call site is > irrelevant (but there must be some initial value, e.g. None, to be able to > identify the variable). > > Surely there are other ways to deal with the UX problem you indicate (e.g. > namedtuple). > > --Guido > >

[Python-ideas] Re: [new idea] dynamic return with using function argument

2019-08-26 Thread HUANG YUWEI
you can return multiple values from a function using a tuple? >> E.g. >> >> def foo(): >> return 3, 42 >> >> x, y = foo() >> print(x) # 3 >> print(y) # 42 >> >> --Guido >> >> On Mon, Aug 26, 2019 at 5:57 AM HUANG YUWE

[Python-ideas] [new idea] dynamic return with using function argument

2019-08-26 Thread HUANG YUWEI
Dear Python community, I am a heavy python user in numerical simulation. In python 3.8, we will have a new syntax `:=` that could assign values to variables as part of larger expression like, ``` if (n:=len(a)) > 10: ``` On the other hand, I also think that it would be useful if `:=`