alister alister.nospam.ware at
Fri Oct 31 10:59:30 CET 2014

On Thu, 30 Oct 2014 17:34:57 -0400, Seymore4Head wrote:

> On Thu, 30 Oct 2014 14:28:19 -0700, Larry Hudson <orgnut at>
> wrote:
>>On 10/30/2014 01:16 PM, 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\", 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.
>>You have already received the answer -- pax=pet should be pax=pet(), but
>>I have a simple side-comment about style.  It is common Python
>>convention to capitalize class names, IOW make this class Pet instead of
>>class pet.  This is convention not a requirement, but it does help
>>distinguish class names from ordinary variable names -- especially to
>>others reading your code (as well as yourself a few days later).   ;-)
>>      -=- Larry -=-
> I try to take typing shortcuts and it bites me in the behind.
> Good suggestion Thanks

If shortcuts were safe and easy they would not be shortcuts they would be 
the way.

It is best to avoid shortcuts whilst learning untill you know the full 
implications. you will find your learning goes much smother & faster.

We are all in the gutter, but some of us are looking at the stars.
		-- Oscar Wilde

More information about the Python-list mailing list