Author mark.dickinson
Recipients dstufft, mark.dickinson, ncoghlan, tim.peters, yselivanov
Date 2014-03-06.08:39:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394095160.81.0.951452723349.issue20855@psf.upfronthosting.co.za>
In-reply-to
Content
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'.
History
Date User Action Args
2014-03-06 08:39:21mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, ncoghlan, yselivanov, dstufft
2014-03-06 08:39:20mark.dickinsonsetmessageid: <1394095160.81.0.951452723349.issue20855@psf.upfronthosting.co.za>
2014-03-06 08:39:20mark.dickinsonlinkissue20855 messages
2014-03-06 08:39:19mark.dickinsoncreate