[sage-combinat-devel] Re: caching a generator?

2011-05-26 Thread Simon King
A question to Python experts: A generator function somehow stores the internal state (i.e., a pointer to the current line of code and the value of local variables. I know how to obtain the *names* of local variables, such as here: sage: def t(n): : for i in range(n): : yield i

[sage-combinat-devel] Re: caching a generator?

2011-05-26 Thread Simon King
Hi Dan, On 26 Mai, 02:14, Dan Drake wrote: > If I use @disk_cached_function, won't it just cache the *generator* > produced by squares_less_than(10), and not anything like [0, 1, 4, 9]? Indeed: sage: @cached_function : def squares_less_than(n): : for i in range(floor(sqrt(n))): :

[sage-combinat-devel] subposet is very slow...

2011-05-26 Thread Florent Hivert
Dear posets fan, I was trying to use the subposet method of posets and I find it extremely slow. I'll post a ticket together with a patch when I'll connect to a network (I'm currently on the sea shore ;-). The main reason why it is slow is because to construct a subposet of cardinality 23 o