Seymore4Head at Hotmail.invalid
Thu Oct 30 22:00:09 CET 2014
On Thu, 30 Oct 2014 13:33:01 -0700 (PDT), sohcahtoa82 at gmail.com wrote:
>On Thursday, October 30, 2014 1:19:57 PM UTC-7, Seymore4Head wrote:
>> class pet:
>> def set_age(self,age):
>> def get_age(self):
>> return self.age
>> Traceback (most recent call last):
>> File "C:\Functions\test.py", line 18, in <module>
>> 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.
More information about the Python-list