Alexey Vyskubov’s Post

Today I had problem with #Python which in hindsight looks obvious, but I got too much tunnel vision. See: >>> s = (s1 if isinstance(s1, str) else s2 if isinstance(s2, str) else '') >>> s '' So we got fall-through here. But >>> print(type(s1), type(s2)) <class 'str'> <class 'str'> Well, there was no fall-through, it was a tunnel vision: s1 was empty string, so s got s1 value.

Why not just write a function and unit test etc

Like
Reply

To view or add a comment, sign in

Explore content categories