ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 20 Jun 2020 09:35:24 +0200Importing more_itertoolshttps://ask.sagemath.org/question/52099/importing-more_itertools/I have just find the wonderfull library `more_itertools`. I have installed it. When I try
from more_itertools import roundrobin
`roundrobin` is perfectly accessible. But for
But now as i want alos `intersperse`, I have tried
from more_itertools import intersperse
but I have an error.
So I have tried
import more_itertools as mi
It seems to be ok to work but it doesn't find the `repeat` function. Error : `name 'repeat' is not defined`.
I wonder why ?Fri, 19 Jun 2020 17:59:57 +0200https://ask.sagemath.org/question/52099/importing-more_itertools/Comment by Cyrille for <p>I have just find the wonderfull library <code>more_itertools</code>. I have installed it. When I try</p>
<pre><code>from more_itertools import roundrobin
</code></pre>
<p><code>roundrobin</code> is perfectly accessible. But for</p>
<p>But now as i want alos <code>intersperse</code>, I have tried </p>
<pre><code>from more_itertools import intersperse
</code></pre>
<p>but I have an error.</p>
<p>So I have tried</p>
<pre><code>import more_itertools as mi
</code></pre>
<p>It seems to be ok to work but it doesn't find the <code>repeat</code> function. Error : <code>name 'repeat' is not defined</code>.</p>
<p>I wonder why ?</p>
https://ask.sagemath.org/question/52099/importing-more_itertools/?comment=52101#post-id-52101I have seen that `repeat()` is an `itertools` function. So I have tried to install ther is no matching distribution.Fri, 19 Jun 2020 18:57:23 +0200https://ask.sagemath.org/question/52099/importing-more_itertools/?comment=52101#post-id-52101Answer by John Palmieri for <p>I have just find the wonderfull library <code>more_itertools</code>. I have installed it. When I try</p>
<pre><code>from more_itertools import roundrobin
</code></pre>
<p><code>roundrobin</code> is perfectly accessible. But for</p>
<p>But now as i want alos <code>intersperse</code>, I have tried </p>
<pre><code>from more_itertools import intersperse
</code></pre>
<p>but I have an error.</p>
<p>So I have tried</p>
<pre><code>import more_itertools as mi
</code></pre>
<p>It seems to be ok to work but it doesn't find the <code>repeat</code> function. Error : <code>name 'repeat' is not defined</code>.</p>
<p>I wonder why ?</p>
https://ask.sagemath.org/question/52099/importing-more_itertools/?answer=52104#post-id-52104What version of Sage/Python are you using? What version of more_itertools? What error do you get when you try `from more_itertools import intersperse`? For what it's worth, that command works just fine for me. Finally, I don't understand what you're asking about `repeat`. It's in `itertools`, not `more_itertools`, so perhaps should the last few sentences of your question be deleted?Fri, 19 Jun 2020 20:44:39 +0200https://ask.sagemath.org/question/52099/importing-more_itertools/?answer=52104#post-id-52104Comment by Cyrille for <p>What version of Sage/Python are you using? What version of more_itertools? What error do you get when you try <code>from more_itertools import intersperse</code>? For what it's worth, that command works just fine for me. Finally, I don't understand what you're asking about <code>repeat</code>. It's in <code>itertools</code>, not <code>more_itertools</code>, so perhaps should the last few sentences of your question be deleted?</p>
https://ask.sagemath.org/question/52099/importing-more_itertools/?comment=52121#post-id-52121Thanks John. I used Python3. I have made two mistake. The one yopu have shown and to use interspace and not mi.interspace. Now it works.Sat, 20 Jun 2020 09:35:24 +0200https://ask.sagemath.org/question/52099/importing-more_itertools/?comment=52121#post-id-52121