Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Nov 10

All Python objects have a Truthy/Falsy value. This is the value of an object when used in a Boolean context. For example, when used in the condition of an `if` statement. Most objects are Truthy, with a few exceptions. For most types, the “nothing” or “empty” value is Falsy.

2 likes 1 replies

?

Replies

Rodrigo Girão Serrão 🐍🚀 · Nov 10

Then, all other values are “Truthy”. E.g., the empty list is Falsy but any other list is Truthy. So, you can use the Truthy/Falsy value of a list to check if it's empty. This is very idiomatic in Python. Some other types don't have Falsy values!