On 2018-07-25 23:53, David Mertz wrote: > On Wed, Jul 25, 2018, 11:27 PM Chris Angelico <[email protected] > <mailto:[email protected]>> wrote: > > > means that you cannot do this: > > >>> NullCoalesce(spam).nil is None > > This IS fundamentally unfixable in a library. > > > Right now, you can still always call .unbox() at the end to get the > underlying value. I agree that's a little ugly, hence why I added the > wrapt proxy stuff. Most operations trigger unboxing, but indeed not > simply echoing to the shell. >
Chris is correct to point out this problem with comparing to None. I have that problem with my own version of the proxy library, similar to what David is building: I use the proxy heavily; to the point where almost any line may be touching a proxy rather than a real value. To avoid bugs, I disallow "is None" comparisons, mandating "== None" instead. Using unbox() is an alternative, but it is uglier than than swapping "as" for "==".
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
