On 15 April 2010 03:41, Stefan Behnel <[email protected]> wrote:
> Robert Bradshaw, 15.04.2010 08:07:
>> On Apr 14, 2010, at 10:55 PM, Stefan Behnel wrote:
>>
>>> Robert Bradshaw, 15.04.2010 01:39:
>>>> On Apr 14, 2010, at 4:31 PM, Lisandro Dalcin wrote:
>>>>
>>>>> On 14 April 2010 19:38, Greg Ewing wrote:
>>>>>> Stefan Behnel wrote:
>>>>>>
>>>>>>> Should builtins continue to accept None or should it behave like
>>>>>>> other
>>>>>>> extension types?
>>>>>>
>>>>>> Pyrex treats them just like any other extension type. In
>>>>>> fact the *are* just extension types that happen to be
>>>>>> predeclared.
>>>>
>>>> In Cython, builtin types are a bit special as it checks to make sure
>>>> it is exactly the specified type, not just a subclass. (Otherwise,
>>>> there's little room for optimization and so little point in declaring
>>>> them.)
>>>>
>>>>> I agree with Greg and Stefan, i.e., no special handling for builtin
>>>>> types.
>>>>
>>>> Yes, lets not an an exception to the exception...
>>>
>>> Ok, so it looks like we agree that this should raise an exception:
>>>
>>>      def func(list L not None):
>>>
>>> How about this:
>>>
>>>      def func(object obj not None):
>>>
>>> which should likely behave the same as this:
>>>
>>>      def func(obj not None):
>>>
>>> I assume that this should also be allowed and behave like the other
>>> extension types, right?
>>
>> No, I would actually make an exception here--normally
>>
>>       def func(Type x not None)
>>
>> throws an error if and only if not isinstance(x, Type). The "object"
>> type is different is not really treated like an extension type. If
>> something is "[object] obj not None" then I think it should actually
>> reject None.
>
> ;) that's exactly what I meant.
>

Sorry, I'm a bit confused... Does this means that this code:

# cython: allow_none_for_extension_args=False
def func(obj): pass

then I call "func(None)" from Python code and get and exception??



-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to