Logo

Programming-Idioms

History of Idiom 110 > diff from v36 to v37

Edit summary for version 37 by justafoo:
[Python] take None into account

Version 36

2019-09-26, 17:57:45

Version 37

2019-09-26, 17:58:16

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Code
blank = not s.strip()
Code
blank = s is None or not s.strip()