Message366901
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()
" |
|
Date |
User |
Action |
Args |
2020-04-20 23:18:37 | veky | set | recipients:
+ veky, rhettinger, docs@python, Dominik V. |
2020-04-20 23:18:37 | veky | set | messageid: <1587424717.44.0.404027510381.issue40342@roundup.psfhosted.org> |
2020-04-20 23:18:37 | veky | link | issue40342 messages |
2020-04-20 23:18:37 | veky | create | |
|