From ca97716d6166b7444a6d9b53d40d44f93b286efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 3 Dec 2019 04:37:02 +0100 Subject: [PATCH] Property --- README.md | 1 + index.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c8ffbb..dfb3fec 100644 --- a/README.md +++ b/README.md @@ -1012,6 +1012,7 @@ class C(A, B): pass ``` ### Property +**Pythonic way to implement getters and setters.** ```python class MyClass: @property diff --git a/index.html b/index.html index 24af68b..a7cea88 100644 --- a/index.html +++ b/index.html @@ -971,7 +971,7 @@ Z = dataclasses.make_dataclass('Z', [>>> C.mro() [<class 'C'>, <class 'A'>, <class 'B'>, <class 'object'>] -

Property

class MyClass:
+

Property

Pythonic way to implement getters and setters.

class MyClass:
     @property
     def a(self):
         return self._a
@@ -981,6 +981,7 @@ Z = dataclasses.make_dataclass('Z', [
+
>>> el = MyClass()
 >>> el.a = 123
 >>> el.a