[Cython] Out of order side effects of argument evaluation in function calls (ticket #654)

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Mar 12 00:29:28 CET 2011


Stefan Behnel wrote:

> This introduces problems when the arguments have side effects or are not 
> simple, e.g.
> 
>     f(g(a), a.x, h(a))
 >
> What do you think about this?

I think it's a bad idea to write code that relies on the order
of evaluation like this. If the order matters, it's better to
be explicit about it:

    arg1 = g(a)
    arg2 = h(a)
    f(arg1, a.x, arg2)

So I would say it's not something worth worrying about overly
much.

-- 
Greg


More information about the cython-devel mailing list