by Redoubts · 12y ago · 0 comments
As an example, you might represent __bool__ on a database connection object to reflect whether there is a live connection, allowing you to:
if not conn:
conn = MySQLdb.Connect()[1] http://docs.python.org/2/reference/datamodel.html#object.__n...
[2] http://docs.python.org/3/reference/datamodel.html#object.__b...