PEP238 and zope

Christian Tanzer tanzer at
Fri Jul 27 04:39:30 EDT 2001

barry at (Barry A. Warsaw) wrote:

> >>>>> "CT" == Christian Tanzer <tanzer at> writes:
>     >> really-portable-code-is-always-ugly-anyway-ly y'rs,
>     CT> So-lets-make-it-even-uglier-?-ly y'rs,
> I don't consider int(math.floor(a / b)) to be ugly.  In fact, it's
> arguably much more Pythonic: Explicit is better than implicit.
> There's no ambiguity in intention with that idiom, like there is with
> bare a / b.

As they say (at least in german): `tastes vary`.

If `a` and `b` are integer numbers, I consider

    int(math.floor(a / b))

to be considerably uglier than

    int(a / b)

Both are explicit, but use of a floating point function like floor in
a pure integer context is less than obvious. Besides, the quotient
operation might be part of a bigger expression -- even the use of a
single function call might reduce readability there. 

Christian Tanzer                                         tanzer at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92

More information about the Python-list mailing list