Message212795
I realise this was opened as a joke, but I actually consider this suggestion to be unridiculous. I've never felt comfortable with code that does "if x" rather than "if x != 0.0" for x a float.
What really makes this a no-go in Python is the equality between floats and ints, and then between ints and bools. If we want to maintain the invariant that x == y implies bool(x) == bool(y) then we end up making bool(0) and bool(False) true, the latter of which is clearly ridiculous.
So not in Python, but perhaps in some other Python-like language with a notion of 'boolean context'. |
|
Date |
User |
Action |
Args |
2014-03-06 08:39:21 | mark.dickinson | set | recipients:
+ mark.dickinson, tim.peters, ncoghlan, yselivanov, dstufft |
2014-03-06 08:39:20 | mark.dickinson | set | messageid: <1394095160.81.0.951452723349.issue20855@psf.upfronthosting.co.za> |
2014-03-06 08:39:20 | mark.dickinson | link | issue20855 messages |
2014-03-06 08:39:19 | mark.dickinson | create | |
|