Robert Bradshaw wrote:
> The Cython philosophy is that one should be able to take a piece of  
> Python code, compile it with Cython, maybe sprinkle in some static  
> type declarations, and the behavior should be essentially the same

I, for one, like this approach, which is why I was surprised by the None 
issue.

If I write a python function that expects a numpy array, and I pass a 
None into it, I'll get an exception.

If I write a Cython function that expects a numpy array and declare that 
in the function signature, then pass a None it, I get a bus error (or 
who knows what other ugly crash).

I do like the idea that one can pass a None in to signify "no value", or 
"False" or whatever, but there is very little chance that code will 
handle it properly if it wasn't written with that in mind. This is why 
it seems to me that the "not None" behavior should clearly be the default.

I understand the need for backward compatibility, so I'll just try to 
remember to put "not None" in my declarations.

NOTE: it would be a good idea to add that to examples and tutorials, too.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

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

Reply via email to