aboutsummaryrefslogtreecommitdiff
path: root/python.wiki
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-11-22 01:13:49 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-11-22 01:13:49 +0100
commitc8294934cdbe21e33e4f2d5cbfe060548495a645 (patch)
treef09b9edd65451c672a77ccb84b4a65ada7112015 /python.wiki
parentMerge branch 'master' of git.hornquist.se:git/wiki-public (diff)
downloadwiki-public-c8294934cdbe21e33e4f2d5cbfe060548495a645.tar.gz
wiki-public-c8294934cdbe21e33e4f2d5cbfe060548495a645.tar.xz
tis 22 nov 2022 01:13:49 CET
Diffstat (limited to 'python.wiki')
-rw-r--r--python.wiki20
1 files changed, 20 insertions, 0 deletions
diff --git a/python.wiki b/python.wiki
new file mode 100644
index 0000000..1abbf49
--- /dev/null
+++ b/python.wiki
@@ -0,0 +1,20 @@
+= Properties =
+property
+
+{{{python
+field = property(get_f, set_f)
+}}}
+
+{{{python
+class C:
+ def __init__(self):
+ self._x = 10
+
+ @property
+ def x(self):
+ return self._x
+
+ @x.setter
+ def x(self, value):
+ self._x = value
+}}}