On Apr 24, 2009, at 3:07 PM, Lisandro Dalcin wrote:
> On Fri, Apr 24, 2009 at 6:41 PM, Robert Bradshaw
> <[email protected]> wrote:
>> On Apr 24, 2009, at 1:48 PM, Lisandro Dalcin wrote:
>>
>>> On Fri, Apr 24, 2009 at 4:27 PM, Robert Bradshaw
>>> <[email protected]> wrote:
>>>> On Apr 24, 2009, at 8:17 AM, Lisandro Dalcin wrote:
>>>
>>> Of course, then if @cython.cdivision(True) is used, the code in
>>> Shadow should emit a warning, right?
>>
>> No idea how one would do this...
>>
>
> Perhaps something like this
Sorry, for some reason I was thinking about
@cython.cdivision_warnings which would be really hard to emulate in
pure Python...
> (sorry if identation is wrong, still
> missing native support for fixed-width fonts when composing mails in
> Gmail)
>
> # In Shadow.py
> class cdivision:
> def __init__(self, value):
> assert type(value) is bool
> self.value = value
> def __call__(self, function):
> if self.value: warn("C division semantics cannot work on
> Python code")
> return function
C has undefined division semantics, so Python semantics are fine with
cython.cdivision(True) (though I have yet to run into that in
practice). However, almost every compiler directive can't be emulated
in pure Python mode (e.g. we don't truncate integers), so I am of the
opinion that they should just be vacuous and ignored rather than all
raise warnings.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev