Why Python 3?

Ian Kelly ian.g.kelly at gmail.com
Sun Apr 20 20:29:05 EDT 2014


On Apr 20, 2014 8:01 PM, "Gregory Ewing" <greg.ewing at canterbury.ac.nz>
wrote:
>
> Ian Kelly wrote:
>
>> def average(values):
>>     return sum(values) / len(values)
>>
>> This works for decimals, it works for fractions, it works for complex
numbers, it works for numpy types, and in Python 3 it works for ints.
>
>
> That depends on what you mean by "works". I would actually
> find it rather disturbing if an average() function implicitly
> used floor division when given all ints.

The code above never uses floor division in Python 3.  Therefore it "works".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140420/4523c402/attachment.html>


More information about the Python-list mailing list