On Apr 20, 2014 8:01 PM, "Gregory Ewing" <greg.ew...@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".
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to