Re: [Tutor] class newbie

2017-07-23 Thread Michael C
thanks! On Sun, Jul 23, 2017 at 5:35 PM, Danny Yoo wrote: > On Sun, Jul 23, 2017 at 1:24 PM, Michael C > wrote: > > class mahschool: > > def print(): > > print('Say something') > > > By the way, you've chosen a name for your

Re: [Tutor] class newbie

2017-07-23 Thread Mats Wichmann
On 07/23/2017 02:42 PM, Michael C wrote: > never mind, I forgot to put 'self' in the method definition! class mahschool: def print(self): print('Say something') a = mahschool() a.print() Indeed. The error message was clear on this - but not in a way that's always instructive

Re: [Tutor] class newbie

2017-07-23 Thread Danny Yoo
On Sun, Jul 23, 2017 at 1:24 PM, Michael C wrote: > class mahschool: > def print(): > print('Say something') By the way, you've chosen a name for your method that's spelled the same as the name of the built-in "print" function. I'd recommend you

Re: [Tutor] class newbie

2017-07-23 Thread Michael C
never mind, I forgot to put 'self' in the method definition! class mahschool: def print(self): print('Say something') a = mahschool() a.print() On Sun, Jul 23, 2017 at 1:24 PM, Michael C wrote: > class mahschool: > def print(): >

[Tutor] class newbie

2017-07-23 Thread Michael C
class mahschool: def print(): print('Say something') a = mahschool() a.print() With this, I get this error: Traceback (most recent call last): File "test.py", line 8, in a.print() TypeError: print() takes 0 positional arguments but 1 was given What did I do wrong?