On Dec 1, 2009, at 1:43 AM, Stefan Behnel wrote:
> Robert Bradshaw, 01.12.2009 08:41:
>> On Nov 30, 2009, at 10:41 PM, Stefan Behnel wrote:
>>> Robert Bradshaw, 01.12.2009 04:09:
>>>> This is completely orthogonal to type inference.
>>> It's not orthogonal, as type inference currently breaks C type to
>>> untyped Python name assignments, which is exactly the case you
>>> want to
>>> influence with the directive. This means that the char* directive
>>> would override the type inference directive for one special case.
>>
>> I was just using assignment to an untyped variable as an implicit
>> coercion to object in my example. I should have been more explicit
>> and
>> written
>>
>> cdef char* ss = ...
>> cdef object x = ss
>
> In which case you could just as well type x as str, or use an
> explicit cast
> to the type you want. When enabling type inference, the 'default
> behaviour'
> no longer comes for free, except for exactly the function call
> boundary
> cases that I keep stressing.
I agree that the function call boundary is probably the most important
case, but implicit coercions happen in lots of other places.
cdef char* ss = ...
foo = [ss], {ss: ss}, ss
my_py_function(ss)
py_object.attr = ss
print(ss)
return ss
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev