> I still have to find the bug for the ordering...

The ordering problem was coming from the __cmp__ who was broken in
some particular cases.

The bug was coming from an wrong assumption we were doing on the
status of two iterator i and j once list(izip(i, j)) is called.
Indeed, if the end of i is reached first then our assumption was fine:
both i and j are at the same "position". But if the end of j is
reached first, then next() method was called on i one time more that
we were thinking ...which is very logic finally. See below for the
experiment :

What we were thinking :

sage: from itertools import izip
sage: i = iter(range(10))
sage: j = iter(range(9))
sage: z = izip(j, i)
sage: L = list(z)
sage: i.next()
9
sage: j.next()
Traceback (most recent call last):
...
StopIteration:



The (quite logic) behavior we were not expecting :

sage: from itertools import izip
sage: i = iter(range(10))
sage: j = iter(range(9))
sage: z = izip(i, j)
sage: L = list(z)
sage: i.next()
Traceback (most recent call last):
...
StopIteration:
sage: j.next()
Traceback (most recent call last):
...
StopIteration:


Since the discussion is now about iterators, have you noticed that
since recently some new cool functionalities are available in the
itertools?

sage: from itertools import [TAB]
chain         cycle         ifilter       islice        permutations
starmap
combinations  dropwhile     ifilterfalse  izip          product
takewhile
count         groupby       imap          izip_longest  repeat
tee

If I am not mistaking, it seems combinations, izip_longest,
permutations and product were not there some months ago...


Sébastien

-- 
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-de...@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.

Reply via email to