This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients Dominik V., docs@python, rhettinger, veky
Date 2020-04-20.23:18:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587424717.44.0.404027510381.issue40342@roundup.psfhosted.org>
In-reply-to
Content
I must say I agree with Dominik here. Too many times my students write list comprehensions when they mean a for loop. It's not just a "has result vs updates inplace" dichotomy: often it produces some output like a drawing or just a print() call [one of rare things that was better when print was a command is that it was impossible to do this:]. Yes, I know print call is not a method, but e.g. .plot() on DataFrame is. I'd sleep easier if I knew the Programming FAQ didn't encourage this style.

It would be enough to add a sentence of a sort
"If you don't care about the return value of the method, use a for loop.
for obj in mylist: obj.method()
"
History
Date User Action Args
2020-04-20 23:18:37vekysetrecipients: + veky, rhettinger, docs@python, Dominik V.
2020-04-20 23:18:37vekysetmessageid: <1587424717.44.0.404027510381.issue40342@roundup.psfhosted.org>
2020-04-20 23:18:37vekylinkissue40342 messages
2020-04-20 23:18:37vekycreate