1

Possible Duplicates:
python ‘self’ explained
Why do you need explicitly have the “self” argument into a Python method?

Why does Python require the "self" parameter for methods?

For example def method_abc(self, arg1)

And is there ever a date that the need for it will be removed?

3

1 Answer 1

0

Python gives you the option of naming it something other than self, even though the standard is to name it self. Just as it gives you the option of using tabs for indents, even though the standard is to use spaces.

In other words, it's not just "assumed" because...

  1. To give you naming flexibility
  2. To make it clearer that something will be passed self (or not).
Sign up to request clarification or add additional context in comments.

2 Comments

So you're saying, I don't have to define "self" as my first parameter in any of my functions/methods?
@TeddyB, no, what @Amber wrote was that you do not have to name it "self" -- you're free to name it whatever you like. The first parameter of a class method will always be passed a reference to the instance.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.