Author mwallerb
Recipients AlexWaygood, docs@python, mwallerb, rhettinger
Date 2022-01-14.22:58:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642201132.93.0.118008242697.issue46379@roundup.psfhosted.org>
In-reply-to
Content
> 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", i.e., level-by-level, rather than element-by-element.

Also, I think from a functional programming perspective, which, let's face it, is what these iteration/generator tools are really modelling, a recursive version is much more natural.  It also generalizes nicely to other problems which people may be having -- so it has the added benefit of explaining the code and teaching people useful patterns.

Take the itertools.permutation as an example:  writing that as it was in the reference implementation the code is IMHO pretty opaque and hard to reason about.  Write it in a recursive style and both its working and correctness is immediately obvious.

>  Plus it is hard to step through by hand to see what it is doing.

This I agree with.

Anyway, thanks for taking the time to explain the rejection.
History
Date User Action Args
2022-01-14 22:58:52mwallerbsetrecipients: + mwallerb, rhettinger, docs@python, AlexWaygood
2022-01-14 22:58:52mwallerbsetmessageid: <1642201132.93.0.118008242697.issue46379@roundup.psfhosted.org>
2022-01-14 22:58:52mwallerblinkissue46379 messages
2022-01-14 22:58:52mwallerbcreate