<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace"><span style="font-family:arial,sans-serif">On Tue, Sep 5, 2017 at 10:43 AM, Pavol Lisy </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:pavol.lisy@gmail.com" target="_blank">pavol.lisy@gmail.com</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 9/4/17, Koos Zevenhoven <<a href="mailto:k7hoven@gmail.com">k7hoven@gmail.com</a>> wrote:<br>
<div class="gmail_default" style="font-family:monospace,monospace;display:inline">​[...]​</div><br>>  Â  Â with cvar.assign(new_value):<br>
>  Â  Â  Â  Â assert cvar.value is new_value<br>
>  Â  Â  Â  Â # Any code here, or down the call chain from here, sees:<br>
>  Â  Â  Â  Â #  Â  Â cvar.value is new_value<br>
>  Â  Â  Â  Â # unless another value has been assigned in a<br>
>  Â  Â  Â  Â # nested context<br>
>  Â  Â  Â  Â assert cvar.value is new_value<br>
>  Â  Â # the assignment of ``cvar`` to ``new_value`` is no longer visible<br>
>  Â  Â assert cvar.value == "the default value"<br>
<br>
</span>I feel that of "is" and "==" in assert statements in this PEP has to<br>
be used (or described) more precisely.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace">​​</div><div class="gmail_default" style="font-family:monospace,monospace">​The use is quite precise as it is now. I can't use `is` for the string values, because the result would depend on whether Python gives you the same str instance as before, or a new one with the same content.​ Maybe I'll get rid of literal string values in the description, since it seems to only cause distraction.</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
What if new_value above is 123456789?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace">​Any value is fine.​</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
maybe using something like could be better? -><br>
<br>
  Â def equals(a, b):<br>
  Â  Â  return a is b or a == b<br>
<br>
Doesn't PEP need to think about something like "context level overflow" ?<br>
<br>
Or members like: cvar.level ?<br></blockquote><div><br></div><div class="gmail_default" style="font-family:monospace,monospace">I don't see any need for this at this point, or possibly ever.​</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div></div><br><div class="gmail_default" style="font-family:monospace,monospace">​––Koos​</div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">+ Koos Zevenhoven + <a href="http://twitter.com/k7hoven" target="_blank">http://twitter.com/k7hoven</a> +</div>
</div></div>