Search code examples
pythonself

Any ideas about how to get rid of self?


Is there anyway of making Python methods have access to the class fields/methods without using the self parameter?

It's really annoying having to write self. self. self. self. The code gets so ugly to the point I'm thinking of not using classes anymore purely for code aesthetics. I don't care about the risks or best practices. I just want not to see self anymore.

P.S. I know about the renaming possibility but it's not the point.


Solution

  • No, there isn't. You could though use another word instead of self, although the convention is to use "self".