Saw something on YouTube that has me very confused. I was scrolling through Shorts when a #Python tutorial came up that started with `import itertools`. Because of this, the comments were full of "oh look, another Python tutorial that involves installing a package with thousands of dependencies to do a simple thing." 1/3
The thing is, though, itertools is in CPython's standard library, so it ships with it and has no additional dependencies. The commenters seemed to believe that, because it had to be imported, there was no way it was a built-in. Namespacing like this is not exactly unique to Python, so I don't know if this is just JS devs who don't understand that not every language's stdlib is in the global namespace (not knocking JS devs, but JS as a language definitely functions differently than most) 2/3
The argument would hold water if they were talking about needing a solution that could still work in Python implementations that don't have or have a different standard library, but that's definitely not what was going on. Does anybody have any insights here? 3/3
@Ben_KC My guess is that many newbies just don't know about itertools and it being in the stdlib 🤷‍♀️ I wouldn't expect senior engineers to watch beginners tutorials on YouTube and leave thoughtful comments. Why would they?

@Ben_KC TBH, I can't even blame them. You probably won't encounter itertools in the wild too often. I used to use itertools a lot very long time ago but nowadays I maybe import `chain` sometimes, maybe `product` once a year, and that's it. Most often, writing a generator function with some loops gets things done without much boilerplate.

UPD: not to say it's useless, just not common.

@orsinium That's fair. I feel like I mostly see it in TIL stuff when somebody realizes that itertools has a nice concise way of doing something that's otherwise a bit complex, but I also rarely use it myself in day-to-day stuff. What was really throwing me off was seeing so many people expressing the sentiment that needing to import things in Python was some kind of problem.