On Tue, Oct 20, 2009 at 6:50 AM, Stefan Behnel <[email protected]> wrote:
>
> Robert Bradshaw wrote:
>> On Oct 19, 2009, at 5:09 PM, Neal Becker wrote:
>>
>>> Lisandro Dalcin wrote:
>>>
>>> ...
>>>> A possible backward way could be to  introduce (slightly) new syntax,
>>>> something like <SomeType??>, i.e using two '?' to indicate a
>>>> "stronger" type check disallowing None...
>>> That would be spelled <SomeType?!>
>>> :)
>>
>> Well, or one could use the nonecheck directive. I'd like to avoid
>> adding more syntax for a problem that'll go away with a smarter
>> compiler.
>
> +1
>
> I also think that the chance of breaking code with this change is rather
> small. I can't imagine that many use cases where I would cast a value to a
> specific extension type other than accessing its C attributes or methods,
> which would clearly lead to a crash for None values. So however people used
> this feature before, I expect a None check to be very close in the code.
>

OK, patch uploaded:
http://trac.cython.org/cython_trac/attachment/ticket/417/typetest.diff

Please review, and let me know if it is good enough for pushing...

BTW, there is one usage of PyTypeTestNode at
Cython/Compiler/Optimize.py ... Should we pass notnone=True there?


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to