Re: [Tutor] properties beginner M Dawson book

2012-06-11 Thread Alan Gauld
On 11/06/12 16:05, brian arb wrote: Highly recommend writing unittest, each unit test sends a specific input to a method and verifies that the method returns the expected value, or takes the expected action. Unit tests prove that the code you are testing does in fact do what you expect it to do.

Re: [Tutor] properties beginner M Dawson book

2012-06-11 Thread Mark Lawrence
On 11/06/2012 16:05, brian arb wrote: I would look into pylint, Python source code looking for bugs and signs of poor quality. Or pychecker or pyflakes. -- Cheers. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] properties beginner M Dawson book

2012-06-11 Thread brian arb
I'm a bad fan of Nick Parlante teaching style. He has a excellent site that has some exercises to teach Python, and they are backed with unittests. http://codingbat.com/python On Mon, Jun 11, 2012 at 11:05 AM, brian arb wrote: > I would look into pylint, Python sou

Re: [Tutor] properties beginner M Dawson book

2012-06-11 Thread brian arb
I would look into pylint, Python source code looking for bugs and signs of poor quality. > There are, unfortunately, no answers nor examples of good and bad code. > Honestly I don’t want to “cheat” but I have to teach Python to some young > students in September, using this book, and I want all

Re: [Tutor] properties beginner M Dawson book

2012-06-11 Thread Emile van Sebille
On 6/10/2012 4:58 AM Steven D'Aprano said... Nicholas Harman wrote: I have done a little programming in BlueJ Java before but I decided to try the “Python style” as explained in the chapter, using properties rather than variables and getters and setters . My main question is: When using pro

Re: [Tutor] properties beginner M Dawson book

2012-06-10 Thread Steven D'Aprano
Nicholas Harman wrote: class Television(object): #Contstructor Spelling error: Constructor. Actually, technically __init__ is not the constructor. __init__ is the initializer, as the object has already been created before __init__ is called. __new__ is the constructor, although in this

Re: [Tutor] properties beginner M Dawson book

2012-06-10 Thread Steven D'Aprano
Nicholas Harman wrote: I have done a little programming in BlueJ Java before but I decided to try the “Python style” as explained in the chapter, using properties rather than variables and getters and setters . My main question is: When using property and setter it seems I must use “__name”

[Tutor] properties beginner M Dawson book

2012-06-10 Thread Nicholas Harman
Hi, I am teaching myself Python with the book :Python Programming for the Absolute Beginner, 3rd edition by M Dawson. It is an excellent book and I am enjoying completing the challenges at the end of each chapter. There are, unfortunately, no answers nor examples of good and bad code. Honestl