Re:Hidden features of Python
by oddthink on Wednesday July 14, 2010 @10:44AM
(#1514687)
This is only tangentially related, but try looking up "Iverson brackets" and Knuth's "Two notes on notation". One argument there is that False - True = -1 makes sign(x) = [x > 0] - [x < 0], which is convenient. I don't know of a case where True + True = 2 helps, but maybe something involving dual sums would be relevant.
[ Parent
| on HN ]
The Iverson Bracket would already exist in a python that didn't subclass bool from int; '[boolean_expression]' would be, in python notation: 'int(boolean_expression)'.
Sounds kinda like I'm making the same argument as Knuth in forcing '[]' over '()'.