I started using Python in 2001. I loved the simplicity of the language, but one feature that annoyed the heck out of me was the /
operator, which would bite me in subtle places like
def mean(seq):
"""
Return the arithmetic mean of a list
(unless it just happens to contain all ints)
"""
return sum(seq) / len(seq)
Fortunately, PEP 238 had already been written, and as soon as I found about the new from __future__ import division
statement, I started religiously adding it to every .py file I wrote.
But here it is nearly 9 years later and I still frequently see Python code samples that use /
for integer division. Is //
not a widely-known feature? Or is there actually a reason to prefer the old way?