Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-27 Thread Jacco van Dorp
2018-05-26 11:00 GMT+02:00 Kirill Balunov : > The main point is to collect more information, since the idea of assignment > expression will have a huge impact in all aspects of Python programming: how > you structure your programm, how you write code, how you read code, how you > parse code... Beca

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-26 Thread Steven D'Aprano
On Sat, May 26, 2018 at 12:00:45PM +0300, Kirill Balunov wrote: > > It looks like a function you could call from anywhere, but you want > > to limit it to just "while" and "if", I expect that will just give us a > > flood of questions on Stackoverflow and other forums, "why can't I use > > this()

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-26 Thread Kirill Balunov
2018-05-24 4:21 GMT+03:00 Steven D'Aprano : > On Wed, May 23, 2018 at 12:32:36AM +0300, Kirill Balunov wrote: > > > Just one more variation on "assignment exression" syntax to make the list > > more complete :) Sorry, if something similar has already been suggested. > > The idea is to use function

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Steven D'Aprano
On Wed, May 23, 2018 at 12:32:36AM +0300, Kirill Balunov wrote: > Just one more variation on "assignment exression" syntax to make the list > more complete :) Sorry, if something similar has already been suggested. > The idea is to use function's call-like syntax in the from: `this( name = > expr

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Carl Smith
The name `this` is problematic as it has a well established, different meaning in lots of other languages. It's basically `self` for languages that assign to it automatically. Full stack Python users will have `this` meaning two different things at each end, and they cannot alias it in either of th

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Kirill Balunov
2018-05-23 17:54 GMT+03:00 Mike Miller : > > On 2018-05-22 14:32, Kirill Balunov wrote: > >> # in global scope everything works ok since locals is globals >> >>> while len( this( val = dummy() ) ) >= 0: >> ... print(val) >> [0, 1] >> [0, 1, 2] >> [0, 1, 2, 3] >> > > In

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Kirill Balunov
2018-05-23 14:19 GMT+03:00 Masayuki YAMAMOTO : > FYI, I found a package [*] which binds a value by function keyword (I'm > not the author). Note that the package writes a value in the global (or > raise an error if the name already exists in local) unlike your idea. > > [*] https://pypi.org/projec

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Kirill Balunov
2018-05-23 9:05 GMT+03:00 Terry Reedy : > On 5/22/2018 5:32 PM, Kirill Balunov wrote: > >> Just one more variation on "assignment exression" syntax to make the list >> more complete :) Sorry, if something similar has already been suggested. >> The idea is to use function's call-like syntax in the

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Mike Miller
On 2018-05-22 14:32, Kirill Balunov wrote: # in global scope everything works ok since locals is globals >>> while len( this( val = dummy() ) ) >= 0: ...     print(val) [0, 1] [0, 1, 2] [0, 1, 2, 3] Interesting! Although the example with a len() and mutable default ar

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-23 Thread Masayuki YAMAMOTO
2018-05-23 6:32 GMT+09:00 Kirill Balunov : > Just one more variation on "assignment exression" syntax to make the list > more complete :) Sorry, if something similar has already been suggested. > The idea is to use function's call-like syntax in the from: `this( name = > expr )`. I'm not sure that

Re: [Python-ideas] "Assignment expression" with function call-alike syntax

2018-05-22 Thread Terry Reedy
On 5/22/2018 5:32 PM, Kirill Balunov wrote: Just one more variation on "assignment exression" syntax to make the list more complete :) Sorry, if something similar has already been suggested. The idea is to use function's call-like syntax in the from: `this( name = expr )`. Functions names sho