[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators

Random832 random832 at fastmail.com
Tue Nov 24 18:53:07 EST 2015


On 2015-11-24, Brendan Barnwell wrote:
> 	I guess I'm not understanding what you mean by __true__ then.  What is 
> this __true__ for which ([0, 1]).__true__() is not true?

It'd be a new operator / magic-function, so whatever the
person writing the class wants it to be. I specifically
didn't use bool().

def __true__(self):
	# return True ony if you want "or" to short-circuit
	pass



More information about the Python-ideas mailing list