Robert Bradshaw wrote:
> On Apr 23, 2009, at 7:00 PM, Lisandro Dalcin wrote:
>> 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 agree. It's extremely rare to call one-arg functions with keywords (and
there are tons of C extensions out there that disallow it already). The
only sensible case I can think of is the generic function wrapper, i.e.
def wrap(f, *args, **kwargs):
...
f(*args, **kwargs)
BTW, given that the above raises an error (as you said, didn't try), I'm
more inclined to consider that a bug in CPython. If the kwdict is empty, it
can just be ignored in the call mechanism instead of letting the call fail.
There'd be nothing wrong with that.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev