On Apr 23, 2009, at 7:00 PM, Lisandro Dalcin wrote:
> If there are no objections, I'm going to push the one-line patch
> below.
Yes, we should do that. Actually, it probably makes more sense
logically to do
if self.entry.is_special:
...
elif Options.optimize_simple_methods and not self.star_arg and not
self.starstar_arg:
...
> BTW, Why this optimization is on by default? Despite the comment on
> Options.py, IMHO we should emulate Python semantics here. A METH_O
> method cannot be called like this "func(arg, **{})", but that works
> for methods defined in Python code.
This optimization is on by default because it is extremely common and
does have a noticeable impact on timings (don't recall offhand any
actual numbers here). Now that we have compiler directives, we should
be using them here, but unlike the C division case I think it's a bad
idea to change the default because it gives a (rather comprehensible)
error rather than silently continuing with different behavior. You're
the second person since this optimization was introduced well over a
year ago to even notice.
I am still in favor of a emulate-pure-python-no-matter-what-the-cost
compiler directive that would disable this (and other discrepancies
we may find). It should also be better documented. http://
trac.cython.org/cython_trac/ticket/295
- Robert
> $ hg diff
> diff -r c3bf82e34e54 Cython/Compiler/Nodes.py
> --- a/Cython/Compiler/Nodes.py Thu Apr 23 20:08:25 2009 +0200
> +++ b/Cython/Compiler/Nodes.py Thu Apr 23 22:49:15 2009 -0300
> @@ -1699,7 +1699,7 @@
> elif len(self.args) == 1:
> if self.args[0].default is None and not
> self.args[0].kw_only:
> self.entry.signature =
> TypeSlots.pyfunction_onearg
> - elif self.entry.signature is
> TypeSlots.pymethod_signature:
> + elif self.entry.signature is TypeSlots.pymethod_signature
> and Options.optimize_simple_methods:
> if len(self.args) == 1:
> self.entry.signature = TypeSlots.unaryfunc
> elif len(self.args) == 2:
>
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev