On Mar 11, 2009, at 11:20 PM, Stefan Behnel wrote:

> Robert Bradshaw wrote:
>> I think this is neither the first nor last issue that will come up
>> like this. What I think we should do is have a "-pedantic" flag which
>> obeys Python semantics exactly, at the expense of speed. This applies
>> to %, //, **, etc. (Overflowing is a separate issue, and I think
>> there should be a flag for that too.) Compilation of .py files would
>> be, by default, with -pedantic enabled, and compilation of .pyx files
>> with it disabled.
>
> Wouldn't it be better to have such a flag emit warnings (preferably  
> with a
> hint how to write better code) instead of changing the semantics of  
> operators?

It won't be very useful to emit a warning on, for example, every %  
operator. Also, I really want to be able to write code values speed  
over perfect Python semantics, and at the same time take a .py file  
and not have to worry about subtle corner-case changes. The problem  
is that both modes are very defendable as the default.

> I think having operators change their semantics without a clear  
> change in
> the user code (such as a __future__ import) is a rather dangerous  
> 'feature'.

I'm convinced pragmas are a better thing to use than a compiler flag.  
One could also imagine adding more granularity with pragmas as well  
(e.g. only use c semantics for % and //, but make sure everything  
else is the same). I'm not sure if this is a good thing...

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to