On 18 Feb 2006 16:48:38 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote:
>Does Python's run-time do any optimization of multiplication
>operations, like it does for boolean short-cutting?

Here's the beginning of int_mul from Objects/intobject.c:

    static PyObject *
    int_mul(PyObject *v, PyObject *w)
    {
        long a, b;
        long longprod;                  /* a*b in native long arithmetic */
        double doubled_longprod;        /* (double)longprod */
        double doubleprod;              /* (double)a * (double)b */

        CONVERT_TO_LONG(v, a);
        CONVERT_TO_LONG(w, b);
        longprod = a * b;
        doubleprod = (double)a * (double)b;
        doubled_longprod = (double)longprod;

I think the rest of the function is probably irrelevant, as far as your 
question goes.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to