aboutsummaryrefslogtreecommitdiff
path: root/python/src/types/buffer.py
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2025-10-14 20:48:03 +0100
committertslil <tslil@posteo.de>2025-10-14 23:28:08 +0100
commit1376a23bda5e6fe94148cb57ca1447907c6bb21e (patch)
treeab158829b82af934837b9c63825de2af001ee9ea /python/src/types/buffer.py
parent723393e8921e2832123b78aa3dec2f87f96b2f74 (diff)
Sketching the implementation of the monad and selections
Diffstat (limited to 'python/src/types/buffer.py')
-rw-r--r--python/src/types/buffer.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/src/types/buffer.py b/python/src/types/buffer.py
new file mode 100644
index 0000000..04e1def
--- /dev/null
+++ b/python/src/types/buffer.py
@@ -0,0 +1,16 @@
+from dataclasses import dataclass
+
+@dataclass
+class Buffer:
+ content: str
+
+ @property
+ def min_pos(self) -> int:
+ return 0
+
+ @property
+ def max_pos(self) -> int:
+ return len(self.content)
+
+ def valid_pos(self, pos : int) -> bool:
+ return self.min_pos <= pos < self.max_pos