On Sat, Jun 15, 2013 at 10:23 PM, eryksun <eryk...@gmail.com> wrote: > This function is hard coded for the singletons True, > False, and None -- and otherwise uses either __bool__ > (tp_as_number->nb_bool) or __len__ (tp_as_mapping->mp_length or > tp_as_sequence->sq_length). A length of 0 is falsey.
I forgot to add that 2.x uses the special method __nonzero__ instead of __bool__. This can return either an int or a bool. In Python 3 __bool__ can only return a bool. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor