KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
False is equivalent to 0 and True is equivalent 1 so it's possible to do something like this: def bool_to_str(value): """value should be a bool""" return ['No', 'Yes'][value] bool_to_str(True) Notice how value is bool but is used as an int . Is this this kind of use Pythonic or should it be avoided?
Tags (comma-separated)
Save Edits
Cancel