Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread boB Stepp
On Fri, Mar 24, 2017 at 9:05 AM, Rafael Knuth wrote: > I have another question :) > I noticed that you split your class into three methods: > > def __init__(self): > # initialize instances of class > > def make_shopping_list(self): > # input > > def display_shopping_list(self): > # output > > I wa

Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread boB Stepp
On Fri, Mar 24, 2017 at 6:51 AM, Rafael Knuth wrote: > Thank you so much for your help. > I have a question: When creating an instance of GroceryListMaker, you are > using: > > if __name__ == "__main__": > > What is that specifically for? > I tested your code and both worked, with and without > i

Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread Alan Gauld via Tutor
On 24/03/17 21:42, boB Stepp wrote: >> I noticed that you split your class into three methods: Many real world classes have a lot more than 3 methods. >> def __init__(self): >> # initialize instances of class >> >> def make_shopping_list(self): >> # input >> >> def display_shopping_list(self): >

Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread Alan Gauld via Tutor
On 24/03/17 21:41, boB Stepp wrote: >> I have a question: When creating an instance of GroceryListMaker, you are >> using: >> >> if __name__ == "__main__": >> >> What is that specifically for? Its a common trick in Python that enables a single file to act as both a module and a program. When a s

Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread boB Stepp
I'm forwarding this to Tutor. Please respond to the whole group and not just me personally, so you can have access to the experts as well as allowing all of us learners the opportunity to learn more. On Fri, Mar 24, 2017 at 9:05 AM, Rafael Knuth wrote: > I have another question :) > I noticed th

Re: [Tutor] Using Class Properly - early beginner question

2017-03-24 Thread boB Stepp
I'm forwarding this to Tutor. Please respond to the whole group and not just me personally, so you can have access to the experts as well as allowing all of us learners the opportunity to learn more. I can't respond now, but will try to do so later. On Fri, Mar 24, 2017 at 6:51 AM, Rafael Knuth