MyClass
An example of class.
An example of class that it extends an abstract class and it implements an interface. There is a boolean pun by not_implemented_and_abstract_method function of abstract class, get_boolean function of interface class, and foobar function of this class.
# license MIT # author Alessandra Bilardi <alessandra.bilardi@gmail.com> # see https://github.com/bilardi/python-prototype for details
Note that the _quux method is not present in the documentation like the other methods because it is a method protected.
>>> from simple_sample.my_class import MyClass
>>> help(MyClass)
# cite https://stackoverflow.com/questions/11483366/protected-method-in-python/11483397#11483397
Python does not support access protection as C++/Java/C# does. Everything is public. The motto is, “We’re all adults here.” Document your classes, and insist that your collaborators read and follow the documentation. The culture in Python is that names starting with underscores mean, “don’t use these unless you really know you should.” You might choose to begin your “protected” methods with underscores. But keep in mind, this is just a convention, it doesn’t change how the method can be accessed.
- class simple_sample.my_class.MyClass(param: bool = True)
An example of class that it extends an abstract class and it implements an interface.
There is a boolean pun by not_implemented_and_abstract_method function of abstract class, get_boolean function of interface class, and foobar function of this class.
- Args:
param(bool): a boolean value
- get_boolean() bool
Override of the class MyClassInterface.
- Returns:
The boolean value of _protected_param
- get_param_processing(param: bool) bool
Override of the abstract method gets reverse value of param.
- Args:
param(bool): a boolean value
- Returns:
The reverse value of param
- get_reverse_boolean() bool
Get reverse value of the protected method _protected_method.
- Returns:
The boolean value
- get_reverse_protected_param() bool
Get reverse value of _protected_param.
- Returns:
The reverse value of _protected_param