<br><div class="gmail_quote">On Fri, Jul 15, 2011 at 9:18 AM, Mike Graham <span dir="ltr"><<a href="mailto:mikegraham@gmail.com">mikegraham@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Fri, Jul 15, 2011 at 10:05 AM, Don Spaulding<br>
<<a href="mailto:donspauldingii@gmail.com">donspauldingii@gmail.com</a>> wrote:<br>
</div><div class="im">> When I come across a situation where I want a sentinel that doesn't preclude<br>
> None from being a valid value, I've always spelled it like this:<br>
> SENTINEL = object() # Guaranteed to be unique and not None.<br>
><br>
> def f(arg=SENTINEL):<br>
> if arg is SENTINEL:<br>
> arg = 'foo'<br>
> x(arg)<br>
> It's always worked well, but that little voice in my head tells me there's<br>
> probably something I'm not thinking of that will come back to bite me in the<br>
> future. I don't think this helps the OP in any meaningful way, but I was<br>
> wondering if you bright people might shed some light on the drawbacks of<br>
> this approach for me. What are the better alternatives?<br>
<br>
</div>No, this approach isn't error-prone.<br></blockquote><div><br></div><div>Glad to hear it.</div><div> </div><div>Thanks.</div></div>