Stefan Behnel wrote: > Robert Bradshaw, 25.11.2009 04:27: > >>The underlying issue is that it doesn't recognize that the user- >>declared type could be compatible with the builtin type. We should >>recognize this and allow it. > > I disagree. This would either require us to check the declaration exactly > (in which case there would be zero gain at all, as Cython would need to > know the complete type declaration already), or it would allow users to > declare all sorts of broken things on the type without checking.
The code in question works in Pyrex because the type of the default argument is checked dynamically at run time, just like in any other assignment. Cython appears to be making an excessively static determination of the type here. Having full builtin declarations for all the standard types would be useful, but as long as external type definitions are allowed at all, you can't eliminate the possibility that the user will declare a type in a way that doesn't agree with reality. At some point you just have to trust the programmer, lest you cripple them unnecessarily. -- Greg _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
