Jump to content

Boolean values: Difference between revisions

→‎{{header|Python}}: None is False.
(→‎{{header|Python}}: ++String examples)
(→‎{{header|Python}}: None is False.)
Line 60:
 
A user-created class that defines a <tt>.__nonzero__()</tt> method to return False, or whose <tt>.__len__()</tt> method returns 0 will be treated as <code>False</code>, otherwise the class/instance is treated as <code>True</code>.
 
None is also <code>False</code> in a boolean context.
 
'''Some examples:'''
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.