**Pythonic way of implementing getters and setters.**
```python
class Person:
@property
def name(self):
return ' '.join(self._name)
@name.setter
def name(self, value):
self._name = value.split()
```
```python
>>> person = Person()
>>> person.name = '\t Guido van Rossum \n'
>>> person.name
'Guido van Rossum'
```
### Type Annotations
* **They add type hints to variables, arguments and functions (`'def f() -> <type>:'`).**
* **Hints are used by type checkers like [mypy](https://pypi.org/project/mypy/), data validation libraries such as [Pydantic](https://pypi.org/project/pydantic/) and lately also by [Cython](https://pypi.org/project/Cython/) compiler. However, they are not enforced by CPython interpreter.**
<div><h3id="property">Property</h3><p><strong>Pythonic way of implementing getters and setters.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">Person</span>:</span>
<li><strong>They add type hints to variables, arguments and functions (<codeclass="python hljs"><spanclass="hljs-string">'def f() -><type>:'</span></code>).</strong></li>
<li><strong>Hints are used by type checkers like <ahref="https://pypi.org/project/mypy/">mypy</a>, data validation libraries such as <ahref="https://pypi.org/project/pydantic/">Pydantic</a> and lately also by <ahref="https://pypi.org/project/Cython/">Cython</a> compiler. However, they are not enforced by CPython interpreter.</strong></li>
@ -889,22 +905,6 @@ Z = dataclasses.make_dataclass(<span class="hljs-string">'Z'</span>, [<span clas
<div><h3id="property">Property</h3><p><strong>Pythonic way of implementing getters and setters.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">Person</span>:</span>
<spanclass="hljs-string">'Guido van Rossum'</span>
</code></pre>
<div><h3id="slots">Slots</h3><p><strong>Mechanism that restricts objects to attributes listed in 'slots', reduces their memory footprint.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">MyClassWithSlots</span>:</span>