On Tue, Sep 5, 2017 at 10:43 AM, Pavol Lisy <pavol.lisy@gmail.com> wrote:
On 9/4/17, Koos Zevenhoven <k7hoven@gmail.com> wrote:

>     with cvar.assign(new_value):
>         assert cvar.value is new_value
>         # Any code here, or down the call chain from here, sees:
>         #     cvar.value is new_value
>         # unless another value has been assigned in a
>         # nested context
>         assert cvar.value is new_value
>     # the assignment of ``cvar`` to ``new_value`` is no longer visible
>     assert cvar.value == "the default value"

I feel that of "is" and "==" in assert statements in this PEP has to
be used (or described) more precisely.

​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.


What if new_value above is 123456789?

​Any value is fine.​


maybe using something like could be better? ->

   def equals(a, b):
      return a is b or a == b

Doesn't PEP need to think about something like "context level overflow" ?

Or members like: cvar.level ?

I don't see any need for this at this point, or possibly ever.​


+ Koos Zevenhoven + http://twitter.com/k7hoven +