On Thu, Aug 01, 2019 at 12:31:48PM -0700, Andrew Barnert via Python-ideas wrote:
Plus, there is another potential argument for adding at least some of the recipes to the module. When I show a novice how to import and use cycle, they they get excited and go off and use it.
Are infinite for-loops that common that people get excited by cycle? That sounds like the "here's a hammer, now every problem is a nail" issue. "itertools.cycle is cool, I must use it as often as possible!"
I think I've used it once or twice, but I don't remember why.
When I show them how to copy and paste grouper, they sometimes seem reluctant—I’m encouraging them to put code they don’t understand into their source files.
I expect that the average novice has *vast* amounts of code they don't understand in their source files, some of it borrowed from Stackoverflow or copied and pasted from elsewhere. On the tutor mailing list, debugging by random perturbation until it stops raising an exception is a very common trap for novices, so often they don't understand their own code. I am skeptical that reluctance to use code they don't understand is the reason for their reluctance to copy and paste.
In any case, why is "copy and paste three lines of code I don't understand" worse than "add a dependency of a third-party library you download from the Internet of hundreds, maybe thousands, of lines I don't understand"?