On Wed, Apr 14, 2010 at 11:39 AM, William Laffin
<william.laf...@gmail.com> wrote:
> Hello helpful sage-support list!
>
> Is this the following normal behavior?
> ...
> sage: for x in itertools.chain(itertools.imap(Permutations,range(4))):
>    print x
> ....:
> Standard permutations of 0
> Standard permutations of 1
> Standard permutations of 2
> Standard permutations of 3

Yes, this is the normal behavior.  itertools.chain expects multiple
inputs. It's like the difference between these two:

sage: list(itertools.chain([[1], [2,3], [3,4]]))
[[1], [2, 3], [3, 4]]
sage: list(itertools.chain([1], [2,3], [3,4]))
[1, 2, 3, 3, 4]

Or in your case:

sage: list(itertools.chain(*map(Permutations, range(3))))
[[], [1], [1, 2], [2, 1]]

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe, reply using "remove me" as the subject.

Reply via email to