Robert Bradshaw wrote:
>> Ways to set options:
>>
>> a)
>>
>> #cython: boundscheck=True, other=False
>> #cython: third = no
>>
>> before any code in the file (but whitespace is allowed, I'm using
>> Plex/the parser). The boolean value is case-insensitive and
>> true/false/yes/no is allowed (is this too much? The thing is, for
>> command-line arguments "True" is rather unfriendly and I'd like it  
>> to be
>> consistent).
> 
> I think we should follow a similar format as in PEP 0263.  
> Specifically, I'm not even sure the "cython" is necessary--the  
> compiler directives are arbitrary key-value pairs, and they are  
> looked up as needed. The ones that Cython uses/supports will be  
> documented.
> 
> For the command line, we should be flexible, but a constant literal  
> for the values of the directives (not all of them may be booleans).

I've changed this now in -devel. I realize this is not entirely 
according to process, but you can always back it out (my problem is that 
I want to share it and -dagss is blocked by that error reporting bugfix 
proposal...)

The arguments seemed compelling:
- It is reasonably self-contained and trivial, and is a new feature so 
beta-testers wouldn't regression test it anyway
- There was +3 for this change (including myself)
- It's too late to change this syntax in a few days

You can now do

# boundscheck = True
# boundscheck = False

at the beginning of the file, with whitespace variations only. 
Everything else is ignored (except using something else than True or 
False on rhs, which raises an error). We can loosen up this in a later 
release if we want to.

The regex is:

^#\s*([a-z]+)\s*=(.*)$

and then the first group is matched against a list of possible options 
and the second group stripped for leading and trailing whitespace and 
parsed.

(I've also changed the compiler directive switch to -X now)

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

Reply via email to