bslatkin / effectivepython

Effective Python: Second Edition — Source Code and Errata for the Book
https://effectivepython.com
2.2k stars 710 forks source link

Item 37: unused variable in for loop #98

Open hong-dev opened 3 years ago

hong-dev commented 3 years ago

Item 37, in class WeightedGradebook, there's an unused variable(subject) in for loop as below. :slightly_smiling_face:
Maybe for subject, scores in by_subject.items() can be changed to for scores in by_subject.values()? :hushed:

Screenshot from 2021-04-08 01-19-22

Reference: link to related example_code Thank you! :bow: :pray:

bslatkin commented 1 month ago

Thank you for the report! Yes, you're right -- this would be simpler code and get rid of the unused variable.