On Apr 12, 2010, at 11:06 AM, Christopher Barker wrote:

>>>>>>> * Preparation is being made for making 'not None' the
>>>>>>> default for extension type parameters to Python functions.
>
>>>> I guess I should repeat my big -1 for this then.
>>>>
>>>> I think Java-like behaviour is much more appropriate (i.e. raise  
>>>> proper
>>>> exceptions in the code using the variable, but allow None as a  
>>>> value).
>
> I'm a bit confused here -- how could you have the code checking for  
> None
> everywhere without a performance hit?

Control flow analysis. This will also handle much more than just  
Python function arguments.

> I understand the utility of being able to pass None, but it is really
> dangerous unless it is handled properly, which means the user code  
> needs
> to check for it up front.
>
>>> Would you accept a directive to ENABLE automatic "not None"?
>
> That seems reasonable to me

I would not be opposed to it either given that users would really like  
this behavior, but I would hope that it becomes unnecessary before too  
long.

> -- by the way, is there a deprecation policy for Cython?

No, other than giving ample warnings ahead of time, and we try to  
maintain backwards compatibility.

>> And "not None" is already in the syntax. "Explicit is
>> better than implicit" and all that.
>
> Sure, but leaving it out is not explicit,

it's just like Python

> and it is the more dangerous  option.

Yes, unfortunately the resulting crash is harder...

> An "allow None" would be the right way to be explicit.

If we have a directive, we should also support this (or "or None"  
following Pyrex's choice of syntax).

> -just a couple thoughts from a user.


And thank you for your sharing. Would you be happy with raising same  
exception you'd see in Python if there was no (or very little)  
performance impact?

- Robert

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

Reply via email to