<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
What would be the benefit of adding the "as child_pid" syntax? The<br>
full assignment expression syntax completely covers all the jobs that<br>
you can do with a capturing if statement.<br>
<br></blockquote><div><br></div><div>The "as" syntax over "if" and "while" may go in with all the restrictions and caveats already discussed.</div><div><br></div><div>The discussion about the semantics of how ":=" should affect the enclosing context when used in generators, etc. may continue for as long as it must.</div><div><br></div><div>And there are some of us who like the consistency of "us", and would shy away from ":=".</div><div><br></div><div>For example, Should this be valid?</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><span style="font-size:12.800000190734863px">if child_pid := os.fork():</span></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><span style="font-size:12.800000190734863px">    parent(child_pid)</span></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><span style="font-size:12.800000190734863px">else:</span></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><span style="font-size:12.800000190734863px">   child()</span></div></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><span style="font-size:12.800000190734863px">print(child_pid)</span></div></div></div></blockquote><span style="font-size:12.800000190734863px"><div><span style="font-size:12.800000190734863px"><br></span></div>This shouldn't be:<br></span><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><span style="font-size:12.800000190734863px">if os.fork() as child_pid:</span></div></div><div class="gmail_extra"><div class="gmail_quote"><span style="font-size:12.800000190734863px">    parent(child_pid)</span></div></div><div class="gmail_extra"><div class="gmail_quote"><span style="font-size:12.800000190734863px">else:</span></div></div><div class="gmail_extra"><div class="gmail_quote"><span style="font-size:12.800000190734863px">   child()</span></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><span style="font-size:12.800000190734863px">print(child_pid)  # child_pid is undefined</span></div><div><span style="font-size:12.800000190734863px"><br></span></div></div></blockquote><span style="font-size:12.800000190734863px"></span></div></div>-- <br><div class="gmail_signature"><span style="color:rgb(0,102,0)">Juancarlo </span><b style="color:rgb(0,102,0)">Añez</b></div>
</div></div>