Stefan Behnel wrote: > I've written up a CEP for now: > > http://wiki.cython.org/enhancements/argumentnonechecks
great, thanks! A couple comments: """ Typed argument values that must reject None are more common than those than can safely allow them (without being optional arguments). So the current syntax requires more overhead on the user side than the proposed syntax. """ This seems to be very much style dependent. If I followed the conversation right, Lisandro (and I) would use a lot of "not None", whereas Dag would use a lot of "or None". So I think the more compelling argument is that leaving out a "not None" could result in a segfault, whereas leaving out an "or None" would result in an exception, and be more likely to be caught in tests. About "or None": None is a very common and useful case for an extra type one might want, but it's not the only one -- is there a way to tell Cython that you want to accept one of two (or a few) types? """Changing the behavior of cdef MyExtType x is not an option as the variable requires an initial value and users must be able to set it to a neutral value to destroy the reference they contain. """ This is probably a result of my limited understanding, but I'm still a bit confused about this -- there has got to be a less dangerous way to do that -- after all, people write a lot of code in C without needing it. - Can't you destroy the reference with a "del"? - It doesn't seem onerous to me that an initial value needs to be of the type specified -- that's the cost of static typing. Dag Sverre Seljebotn wrote: > But it can still be compared to Cython-with-control-flow-analysis, at > which point I don't have to bother about "or None" or "not None" at all, > meaning one less thing to think about (and learn!) with respect to pure > Python. Yes, that will be wonderful -- but are we talking months or years before it's a reality? -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
