From 86648bfabf76497ca65298076fd73ada508b1dee Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 4 Sep 2022 13:16:56 +0200 Subject: Vector now supports x and y properties to wram real and imag --- szilagyi/_dataset/__init__.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'szilagyi/_dataset/__init__.py') diff --git a/szilagyi/_dataset/__init__.py b/szilagyi/_dataset/__init__.py index e91251e..18eaee8 100644 --- a/szilagyi/_dataset/__init__.py +++ b/szilagyi/_dataset/__init__.py @@ -4,12 +4,21 @@ import re class Vector(complex): - def __getitem__(self, index): - if index == 0: - return self.real - if index == 1: - return self.imag - raise IndexError + @property + def x(self): + return self.real + + @x.setter + def x(self, value): + self.real = value + + @property + def y(self): + return self.imag + + @y.setter + def y(self, value): + self.imag = value def _load_from(root): -- cgit v1.1