<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">Hi all,</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">I've been following the discussion of assignment expressions and what the syntax for them should be for awhile. The ones that seem to crop up most are the original spelling, :=, the "as" keyword (and variants including it), and the recently "local" pseudo-function idea.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">I have another idea for a spelling of assignment expressions, mostly inspired by real sentence structure. In a review I was writing recently, I referred to CGI, Computer Generated Imagery. As a way of introducing the full term and its abbreviation, I said "Computer Generated Imagery (CGI)". That got me thinking: why not have something similar in Python? Obviously simple parentheses ("expr(name)") definitely wouldn't work, that's a function call. Similarly, brackets ("expr[name]") would be interpreted as subscription. So why not use curly brackets, "expr{name}"? That doesn't conflict with anything (currently it's a syntax error), and could be documented appropriately.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">Going back to the regex example, this is how it would look in that case:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">    if re.match(exp, string){m}:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">        print(m.group(0))</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">I am currently unsure how it would affect scope. I think it should be effectively equivalent to a regular assignment statement (and hence follow identical scope rules), i.e. the above example would be equivalent to the following in all ways except syntax:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">    m = re.match(exp, string):</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">    if m:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">        print(m.group(0))</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff">Thoughts? Please do let me know if there's some critical flaw with this idea that I missed (or tell me if it's an amazing idea ;)), and just give feedback, I guess.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#0000ff"><br></div><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font face="monospace, monospace"><span style="color:rgb(0,0,255)">Sincerely,</span><br></font></div><font color="#0000ff" face="monospace, monospace">Ken;</font><br></div></div></div></div></div></div></div></div></div>
</div>