Dag Sverre Seljebotn wrote:
> Your example code is wrong; you need to actually try to use the object; 
> THEN you will get an exception (where you would otherwise get a crash). 
> Returning a None value is perfectly OK.

hmmm -- I misunderstood when the check was happening. However, I 
actually first tested this on real code, and code and got a hard crash 
when I passed in None. I'll try that test again, and post the actually 
example if it still fails for me.

I also see why this is a performance issue -- the check needs to be done 
at every access, not just when the function starts. Which makes me think 
that Greg's suggestion is really what I want.

I wonder why anyone would want to check on access -- this is different 
than bounds checking -- either the code can handle a None, or it can't. 
It's a type check, rather than a value check.

That's what I get for boiling down the problem to too simple and example!

>  From the docs I pointed you to (I'm sure it could be written clearer):

maybe, though I"m not sure how -- my problem is probably that I'm trying 
to learn from example, but haven't read enough of the docs to grok how 
cython works -- so I didn't understand the docs.

thanks,

-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