[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Make sure numbers are numbers
- From: Henk Boom <henk@...>
- Date: Fri, 16 Apr 2010 19:22:51 -0400
On 16 April 2010 09:36, David Kastrup <firstname.lastname@example.org> wrote:
> If you employ automatic coercions with dynamic typing, code reviews get
> a lot harder because the number of cases you have to review explodes
> exponentially with number of operands. ÂIf you don't employ automatic
> coercions, there is no point in having them.
+1, one example of this is how in python if you have numbers 'a' and
'b'. Python has multiple types of numbers, but people tend to treat
them all the same and pass them around however they want, because of
how they are automatically coerced most of the time. It becomes very
important when you do 'a / b' though, as it could give you integer
division if you happen to get two integers from somewhere.
AFAIK this is why they're adding the '//' integer-division operator in
python 3, to remove this case of overloading.