Message366107
Henry, I have to ask again: please give at least one specific, concrete example of the behavior you're objecting to. English isn't helping, and I still have no idea what your complaint is.
What I'm looking for:
for i in itertools.product(???):
pass
where you replace the ??? with executable code (preferably not using numpy or any other extension package) that provokes the MemoryError you're talking about.
For example, here I'm constructing a case with a million arguments. There's no problem at all:
>>> import itertools
>>> args = [range(100) for i in range(1_000_000)]
>>> for i in itertools.product(*args):
... print(len(i))
[and it prints 1000000 over & over until I get bored and kill it]
Note if it _did_ provoke a problem, we probably wouldn't care - there are no plausible realistic use cases for passing a million arguments to product().
You haven't given us a way to reproduce your complaint, or even a clue as to the number of arguments you're talking about. The above code was my best guess as to what you _might_ be talking about. But since there's no MemoryError in sight, apparently not.
I'm suspecting this may be an XY problem[1], and especially because you posted "a solution" instead of an actual problem ;-)
[1] https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem |
|
Date |
User |
Action |
Args |
2020-04-10 04:51:44 | tim.peters | set | recipients:
+ tim.peters, rhettinger, Dennis Sweeney, Henry Carscadden |
2020-04-10 04:51:44 | tim.peters | set | messageid: <1586494304.62.0.39700204379.issue40230@roundup.psfhosted.org> |
2020-04-10 04:51:44 | tim.peters | link | issue40230 messages |
2020-04-10 04:51:44 | tim.peters | create | |
|