On Jul 24, 2009, at 9:41 PM, Jason Grout wrote: > Lisandro Dalcin wrote: >> On Fri, Jul 24, 2009 at 11:40 PM, Jason >> Grout<[email protected]> wrote: >>> Not if you use comprehension-like syntax. Can Cython support >>> that in >>> the same way it supports list/set/dict comprehensions? >>> >>> Note that in lots of cases, having any/all only support lists >>> kind of >>> defeats the purpose of the short-cutting. >>> >>> {{{id=0| >>> %cython >>> print all(i>=0 for i in range(10)) >>> print any(i<0 for i in range(10)) >>> /// >>> >> >> Wait a minute... this does not have nothing to do with any/all. For >> this to work, Cython have to support GENERATORS... >
Exactly. > Okay. I was hoping that supporting > > all(i>=0 for i in range(10)) > > would be similar to how Cython currently supports > > [i>=0 for i in range(10)] > > > I realize that generators have been a long-requested feature in > Cython. They're closer now than they ever have been, but the last month or two what little time I've had to work on Cython has mostly been related to the GSoC projects. > To be honest, I was surprised that list/set/dict comprehensions > worked. I was hoping it was a small step from there to > supporting any > and all statements like the above. > > However, I also really don't know what I'm talking about, so if the > above doesn't make sense, sorry. This would be possible to support, but it's a rather special case. One would also, perhaps want to support things like sum. Even if we had generators, it's unclear (but not impossible) how they'd work with non-object return types--maybe a next_c method? In the short run, it probably wouldn't be that bad of an addition. Aside from any, all, and sum, what other builtins would we like to support in this manner? - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
