Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ssl232
on Jan 18, 2021
|
parent
|
context
|
favorite
| on:
That XOR Trick (2020)
Hah, I wrote that code on the fly and didn't check the aforementioned test implementation, where I had `(a is None) ^ (b is None)` like the other commenter suggested.
patrec
on Jan 18, 2021
[–]
You could just write this as
(a is None) is not (b is None)
or
(a is None) != (b is None)
It won't make a difference (and is 1 to to 5 characters longer), but it seems "cleaner" since it's more specific.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: