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 steven.daprano
Recipients belopolsky, gregory.p.smith, pitrou, ronaldoussoren, steven.daprano
Date 2013-08-03.07:29:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <51FCB160.9090303@pearwood.info>
In-reply-to <1375498939.37.0.636197500721.issue18606@psf.upfronthosting.co.za>
Content
On 03/08/13 13:02, Alexander Belopolsky wrote:
>
> Alexander Belopolsky added the comment:
>
> Is there a reason why there is no "review" link?  Could it be because the file is uploaded as is rather than as a patch?

I cannot answer that question, sorry.

> In any case, I have a question about this code in sum:
>
>                  # Convert running total to a float. See comment below for
>                  # why we do it this way.
>                  total = type(total).__float__(total)
>
> The "comment below" says:
>
>              # Don't call float() directly, as that converts strings and we
>              # don't want that. Also, like all dunder methods, we should call
>              # __float__ on the class, not the instance.
>              x = type(x).__float__(x)
>
> but this reason does not apply to total that cannot be a string unless you add instances of a really weird class in which case all bets are off and the dunder method won't help much.

My reasoning was that total may be a string if the start parameter is a string, but of course I explicitly check the type of start. So I think you are right.
History
Date User Action Args
2013-08-03 07:29:57steven.dapranosetrecipients: + steven.daprano, gregory.p.smith, ronaldoussoren, belopolsky, pitrou
2013-08-03 07:29:57steven.dapranolinkissue18606 messages
2013-08-03 07:29:57steven.dapranocreate