What is a convention to name a private method in Python?
Experience Level: Junior
Tags: Python
Answer
The private methods should be prefixed with double underscore.
Example:
def __add(x: int, y: int) -> int:
return x + y;
Related Python job interview questions
How do you define a constructor in a class in Python?
Python JuniorWhat is a convention to name a protected method in Python?
Python JuniorHow do you communicate via code what argument types and what return value type a function has?
Python JuniorHow do you define a function in Python?
Python JuniorHow can you display all modules that are currently loaded in your Python program?
Python Junior