CertGrid CertGrid
Concepts·Certified Associate Python Programmer

Python Methods and self

PCAP objective 4.3 is equip a class with methods. A method is a function defined in a class whose first parameter receives the instance - and self is only a convention for that parameter's name. The examinable consequences are the two TypeErrors the extra argument produces, and the fact that obj.method and Class.method are different objects.

Object-Oriented Python Guide 14 of 25 Intermediate

Unbound methods were removed in Python 3: Class.method is a plain function now, not a special object. Python 2 material describing unbound methods no longer applies.

One machine, and any shell with Python 3 will do - these exams test the language, not a distribution.
Server NameIP AddressOSRolesCPURAMHDD
RUNNER01192.168.0.27Ubuntu 26.04 LTSPython 3.14.4 - the only machine this path needs2 Core4 GB50 GB

This guide includes

Use this for the objective on equipping a class with methods. This matters because self is the instance and Python passes it for you - so the two commonest method errors are both about an argument count you did not think you controlled.

Before you start

  1. self is the instance

  2. The same method reached two ways

  3. One argument too many

  4. Forgetting self in the definition

  5. self is a convention, not a keyword

  6. Methods calling methods

  7. Forgetting self inside the method

  8. What the exam does with this objective

Official sources