On Tue, Jan 22, 2013 at 04:33:33AM -0800, Nathann Cohen wrote: > Well, for a start you cannot ask Sage to reverse the iteration order of > anything that you can iterate on. > > First example : reversed(NN) > > And so there is no good solution in general unless you implement the > reversed iterator yourself, or list all elements. > > Then, instead of list(reversed(Compositions(4).list())) (which creates the > list twice in memory plus an interator on top of it), you can do this : > > C = Compositions(4).list() > C.reverse() > > Then : > for c in C: > print c > > or > > for i in range(len(C)): > print C[i]
Tu peux faire aussi: sage: Compositions(4).list()[::-1] [[4], [3, 1], [2, 2], [2, 1, 1], [1, 3], [1, 2, 1], [1, 1, 2], [1, 1, 1, 1]] Par rapport à la solution de Nathann, je fais une copie... Florent -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.