On Fri, Apr 24, 2009 at 1:54 AM, Stefan Behnel <[email protected]> wrote:
>
> 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.

OK, I agree...

>> You're
>> the second person since this optimization was introduced well over a
>> year ago to even notice.
>

Just because now I need that all the args of my methods can be passed
as keywords...


> 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.
>

Sorry, I got confused and provided a bad example... Your "wrap" do
work as long as you your single method appears in *args. In short,
what I need is that methods behave as if they were defined in pure
Python code.

-- 
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

Reply via email to