This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients mark.dickinson, nassrat, pitrou
Date 2008-12-01.12:01:02
SpamBayes Score 9.1623214e-08
Marked as misclassified No
Message-id <1228132850.1350.7.camel@localhost>
In-reply-to <1228130126.92.0.401248751119.issue4479@psf.upfronthosting.co.za>
Content
Le lundi 01 décembre 2008 à 11:15 +0000, Mark Dickinson a écrit :
> My initial reaction to this was negative, but I'm struggling to think of 
> situations where it would be bad.

Consider someone who writes:

z = y / x
return my_list[z]

In all his tests, x is a divisor of y and therefore z is an integer, the
code runs ok.
Suddenly in an use case, x is not a divisor of y, z is therefore a
float, and the "return" line raises a TypeError.

The reverse can also happen, consider something like :

z = y / x
return z.as_integer_ratio()

As for :

<type 'int'>
>>> type(2**-3)
<type 'float'>

I'd argue it is less annoying because it only depends on the value of
the second operand which is, most of the time, a constant, and therefore
you know upfront if the result will be a float or an int.
History
Date User Action Args
2008-12-01 12:01:03pitrousetrecipients: + pitrou, mark.dickinson, nassrat
2008-12-01 12:01:02pitroulinkissue4479 messages
2008-12-01 12:01:02pitroucreate