Thank you . I cannot think of a cleaner way of expressing this logic.

options_specified = [1 for x in [args.username,,] if x]
number_of_options_given = sum(options_specified)
if number_of_options_given > 1:

· · Web · 0 · 0 · 1

@vertigo is this Python? How do you feel about sum(map(bool, [args.username, …]))?

@vertigo It's a _little_ weird that in Python, (True + True == 2), but it sure can be convenient on occasion!

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!