On Thu, 30 Oct 2014 13:33:01 -0700 (PDT), sohcahto...@gmail.com wrote: >On Thursday, October 30, 2014 1:19:57 PM UTC-7, Seymore4Head wrote: >> class pet: >> def set_age(self,age): >> self.age=age >> def get_age(self): >> return self.age >> pax=pet >> pax.set_age(4) >> >> Traceback (most recent call last): >> File "C:\Functions\test.py", line 18, in <module> >> pax.set_age(4) >> TypeError: set_age() missing 1 required positional argument: 'age' >> >> I am trying to pass 4 as the age. Obviously I am doing it wrong. > >The line `pax=pet` doesn't create an instance of your pet class, it creates >essentially a copy of the class definition. > >You need `pax=pet()` > >Or preferably, `pax = pet()`. The spaces are optional, but they make it more >readable.
Thanks -- https://mail.python.org/mailman/listinfo/python-list