Christopher Barker wrote: > 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.
It's for use during debugging -- also this is the behaviour Python gives. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
