Ask Your Question
1

Importing more_itertools

asked 2020-06-19 17:59:57 +0100

Cyrille gravatar image

updated 2020-06-20 08:47:08 +0100

FrédéricC gravatar image

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 ?

edit retag flag offensive close merge delete

Comments

I have seen that repeat() is an itertools function. So I have tried to install ther is no matching distribution.

Cyrille gravatar imageCyrille ( 2020-06-19 18:57:23 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-06-19 20:44:39 +0100

What 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?

edit flag offensive delete link more

Comments

Thanks 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.

Cyrille gravatar imageCyrille ( 2020-06-20 09:35:24 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-06-19 17:59:57 +0100

Seen: 588 times

Last updated: Jun 20 '20