[Python-ideas] Changing the meaning of bool.__invert__

Ethan Furman ethan at stoneleaf.us
Thu Apr 7 12:43:28 EDT 2016


On 04/07/2016 09:02 AM, Joseph Martinot-Lagarde wrote:

> How about the str function ?
> str(True) != str(1)
> str(False) != str(0)

bools are a subclass of int, and the string represention of an int is 
not integral to its value:

class fraction(int):
    ...

fraction('4/2') == 2
str(fraction('4/2')) != str(2)

--
~Ethan~


More information about the Python-ideas mailing list