<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 9, 2016 at 2:57 PM, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
</span>Hmm, so if you'd typically pass in a constant for the parameter<br>
it's deemed poor style, whereas when the value comes from some<br>
variable, it's fine ?<br></blockquote><div><br></div><div>Yes.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This looks more like an API design question than a coding<br>
style one.<br></blockquote><div><br></div><div>Yes. IIRC the question that started this thread was about API design guidance.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
E.g. take this example:<br>
<br>
def process(data, raise_errors=True):<br>
try:<br>
...<br>
return result<br>
except ValueError:<br>
if raise_errors:<br>
raise<br>
else:<br>
return None<br>
<br>
It's not clear whether the caller would run the function<br>
with raise_errors=True or raise_errors=config.raise_errors<br>
more often.<span class=""><br></span></blockquote><div><br></div><div>Yeah, that's for the API designer to guess based on how they envision the API to be used. It's often pretty clear once you start writing some example code though.<br></div></div><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>