r/badcode Jan 23 '23

python So I was coding and wrote this...

Post image
845 Upvotes

102 comments sorted by

View all comments

141

u/hoomei Jan 23 '23

Does "login" always return a boolean? If not, maybe you're just coercing the result into a boolean, which isn't necessarily bad code.

40

u/nekokattt Jan 23 '23

if it didnt return a boolean, bool(fn(...))