diff options
author | Aki <please@ignore.pl> | 2022-09-04 13:16:56 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-09-04 13:16:56 +0200 |
commit | 86648bfabf76497ca65298076fd73ada508b1dee (patch) | |
tree | 0c87c0bd7248a31cd4e3aa60f2089e605d1cfd87 /szilagyi/_dataset/__init__.py | |
parent | 222bc58e3b51a70e95e15fe4681d50809f54c50a (diff) | |
download | szilagyi-86648bfabf76497ca65298076fd73ada508b1dee.zip szilagyi-86648bfabf76497ca65298076fd73ada508b1dee.tar.gz szilagyi-86648bfabf76497ca65298076fd73ada508b1dee.tar.bz2 |
Vector now supports x and y properties to wram real and imag
Diffstat (limited to 'szilagyi/_dataset/__init__.py')
-rw-r--r-- | szilagyi/_dataset/__init__.py | 21 |
1 files changed, 15 insertions, 6 deletions
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): |