Posts: 4,647
Threads: 1,494
Joined: Sep 2016
if this didn't raise an exception, would you expect it to produce an iterator that multiplies this given iterator?
given = reversed('foobar')
other = 6 * given
final = ''.join(x for x in other)
print(final)
this would be expected to work if a str were assigned in line 1 (making line 3 not needed). how would you fix something like this?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
but you multiplied a tuple, not an iterator. what i'm suggesting is than if Python had the ability to multiply an iterator, it should make sense for the product to be a new iterator that carries out iterating the multiplicand iterator (maybe a copy of it) that many times. likewise, adding iterators should give a sum iterator that carries out iterating over all the added iterators. subtraction and division would not make sense in most cases. i can imagine comparing iterators and applying len().
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
i'm interested in studying the ways using iterators could be expanded in case some these make good use cases and make sense for how they get used. i think adding any number of iterators might make sense as well as multiplying them by an int. i might try to make a generator that does this.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
i have looked at itertools. i've used a few several times even before starting this thread. anything in particular you think i should look at?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
Oct-12-2021, 06:52 PM
(This post was last modified: Oct-12-2021, 06:53 PM by Skaperen.)
you are giving me two module names to check. that suggests to me that you don't really know where it is. if you don't that further suggests you don't really know if it does exist.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,647
Threads: 1,494
Joined: Sep 2016
i cannot find Toolz.
itertools.repeat might be the closest in concept but it just gives a repetition of iterators, not one iterator that has all the repetition inside.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.