[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger
Markus Wallerberger added the comment: > To a person well versed in recursion and in generator chains it makes sense > but not so much for anyone else. There I pretty much fundamentally disagree. I find the version in the docs much more magical in the sense that it builds up "laterally",

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please do keep looking for improvements. Suggestions are always welcome. -- ___ Python tracker ___

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Markus, thank you for the suggestion but I'm going to decline. When this rough equivalent was first created, we looked at several recipes and chose this one as being one of the least magical. Intentionally, we did not use the variant you've proposed.

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Alex Waygood
Alex Waygood added the comment: (I'm removing 3.6 and 3.7 from the "versions" field, since those two branches are now only accepting patches if it relates to security.) -- nosy: +AlexWaygood, rhettinger versions: -Python 3.7, Python 3.8 ___

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger
Change by Markus Wallerberger : -- keywords: +patch pull_requests: +28804 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30605 ___ Python tracker

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Markus Wallerberger
New submission from Markus Wallerberger : The reference implementation of itertools.product creates large temporaries, which we need to remind people of at the top of the code block. However, using generator magic, we don't need to do this and can even simplify the code in the process!