>> Ok, so it looks like we agree that this should raise an exception:
>>
>>     def func(list L not None):

yes.

>> How about this:
>>
>>     def func(object obj not None):

This is basically nonsense -- None is an object:

In [7]: isinstance( None, object)
Out[7]: True

so something typedefed to object should be able to hold a None. The 
whole "not None"/"or None" thing simply isn't designed for this.

Given that the user is asking for nonsense, I suppose it doesn't matter 
too much how it's handled, but I'd expect that the "not None" in this 
case would be a no-op.

Unless, we're going to generalize and allow:

def func(object obj not float):

or any other specific type, but we're special casing None for good 
reason here.

> throws an error if and only if not isinstance(x, Type). The "object"  
> type is different is not really treated like an extension type.

and yet the isinstance() check will work anyway, won't it (passing for 
any python object)? Is object already special cased in that way?

> something is "[object] obj not None" then I think it should actually  
> reject None.

That does follow the rule that it is what it says, but I wouldn't make 
any effort in the code to make it work.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

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

Reply via email to