Inspired by a bug from code review today, please enjoy this utterly cursed :python: expression:

if True is ('mystr' in list_of_strings):
....

@padraic_padraic Why is this a bug? True is a singleton, so this should work just fine.

Follow

@deshipu Oh no, the bug was:

if 'mystring' is in list_of_strings

And that was what made me realise that snippet was the 'correct' way of using is in the test

· · Web · 0 · 0 · 1
Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!