Vedran Čačić <ved...@gmail.com> added the comment:

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()
"

----------
nosy: +veky

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40342>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to