DEV Community

Discussion on: 10 Awesome Pythonic One-Liners Explained

Collapse
 
mikaelho profile image
mikaelho

This one I sort of learned today:

' '.join([v for v in [first, middle, last] if v])

Concatenate space-separated full name out of parts, where any of the parts may be an empty string or None.