<div dir="ltr">> if not article["art_wt"]: article["art_wt"] = 0<div>> if not article["px_pchs"]: article["px_pchs"] = 0</div><div>> if not article["px_calc"]: article["px_calc"] = 0</div><div>> if not article["px_sell"]: article["px_sell"] = 0</div><div><br></div><div>I think what you need is the setdefault method of dictionnaries, instead of a new syntax construct.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-26 1:52 GMT+02:00 Carl Smith <span dir="ltr"><<a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">You cannot have `expression if expression` in a language that also supports</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">`expression if expression else expression` (like Python). Otherwise, you have</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">the dangling else problem:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default"><font color="#000000" face="verdana, sans-serif"><a href="https://en.wikipedia.org/wiki/Dangling_else" target="_blank">https://en.wikipedia.org/wiki/<wbr>Dangling_else</a></font><span class="HOEnZb"><font color="#888888"><br></font></span></div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_-5911127467685300768gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace">-- Carl Smith</font></span><br></div></div><div><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace"><a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a></font></span></div></div></div></div></div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On 25 May 2018 at 15:21, Rob Cliffe via Python-ideas <span dir="ltr"><<a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
<br>
On 25/05/2018 12:38, Steven D'Aprano wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
PEP 8 is not holy writ. Ignore it when your code is better for ignoring<br>
it.<br>
<br>
<br>
</blockquote></span>
+1. Not infrequently I judge that my code is easier both to read and to maintain with more than 1 (short) statement on a line,<br>
often when it allows similar items to be aligned vertically. A spur-of-the moment, totally invented example:<br>
if MON <= day <= FRI: Rate = Normal<br>
if day==SAT: Rate = DoubleTime<br>
if day==SUN: Rate = TripleTime<br>
I also feel no inhibitions about using Jacco's original example:<br>
if cond: do_something<span class="m_-5911127467685300768HOEnZb"><font color="#888888"><br>
Rob Cliffe</font></span><div class="m_-5911127467685300768HOEnZb"><div class="m_-5911127467685300768h5"><br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Antoine Rozo</div></div>
</div>