csev / py4e

Web site for www.py4e.com and source to the Python 3.0 textbook
http://www.py4e.com
2.88k stars 1.78k forks source link

Class and Instance Variables #175

Closed cadenzasong closed 10 months ago

cadenzasong commented 6 years ago

Please correct me if I'm missing something, but I think some code examples in chapter 14 is not accurate.

e.g. in party5.py the "x = 0" and "name = """ is class variables (https://docs.python.org/3.7/tutorial/classes.html#class-and-instance-variables), I think it's clearer to remove them and add self.x = 0 in the constructor.

csev commented 10 months ago

I agree - working on fixing. This was a big blind spot when made those examples. I guess a good Java developer can write Java in any language :)

csev commented 10 months ago

This has now been fixed i the latest version https://do1.dr-chuck.com/pythonlearn/EN_us/pythonlearn.pdf - I redid Chapter 8, all the party examples, the slides and Parts 2-4 of the lectures. Please review.

Thanks so much. Literally without you filing this issue I would have wandered off into the sunset being wrong. So thanks.