diff options
| author | tslil <tslil@posteo.de> | 2025-10-14 20:48:03 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2025-10-14 23:28:08 +0100 |
| commit | 1376a23bda5e6fe94148cb57ca1447907c6bb21e (patch) | |
| tree | ab158829b82af934837b9c63825de2af001ee9ea /python/src/types/buffer.py | |
| parent | 723393e8921e2832123b78aa3dec2f87f96b2f74 (diff) | |
Sketching the implementation of the monad and selections
Diffstat (limited to 'python/src/types/buffer.py')
| -rw-r--r-- | python/src/types/buffer.py | 16 |
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 |
