👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
I am coding a small Python module composed of two parts:
- some functions defining a public interface,
- an implementation class used by the above functions, but which is not meaningful outside the module.
At first, I decided to "hide" this implementation class by defining it inside the function using it, but this hampers readability and cannot be used if multiple functions reuse the same class.
So, in addition to comments and docstrings, is there a mechanism to mark a class as "private" or "internal"? I am aware of the underscore mechanism, but as I understand it it only applies to variables, function and methods name.
👻 Read also: what is the best laptop for engineering students?
We hope this article has helped you to resolve the problem. Apart from “Private” (implementation) class in Python, check other COM PHP module-related topics.
Want to excel in Python? See our review of the best Python online courses 2023. If you are interested in Data Science, check also how to learn programming in R.
By the way, this material is also available in other languages:
- Italiano “Private” (implementation) class in Python
- Deutsch “Private” (implementation) class in Python
- Français “Private” (implementation) class in Python
- Español “Private” (implementation) class in Python
- Türk “Private” (implementation) class in Python
- Русский “Private” (implementation) class in Python
- Português “Private” (implementation) class in Python
- Polski “Private” (implementation) class in Python
- Nederlandse “Private” (implementation) class in Python
- 中文 “Private” (implementation) class in Python
- 한국어 “Private” (implementation) class in Python
- 日本語 “Private” (implementation) class in Python
- हिन्दी “Private” (implementation) class in Python
San Francisco | 2023-01-31
Maybe there are another answers? What “Private” (implementation) class in Python exactly means?. Will use it in my bachelor thesis
Prague | 2023-01-31
Simply put and clear. Thank you for sharing. “Private” (implementation) class in Python and other issues with string Python module was always my weak point 😁. Checked yesterday, it works!
Singapore | 2023-01-31
Thanks for explaining! I was stuck with “Private” (implementation) class in Python for some hours, finally got it done 🤗. I just hope that will not emerge anymore