Python-Fuzzylogic/fuzzylogic

Python 3.7 - Invalid syntax

qathom opened this issue · 6 comments

Hello, thanks for creating this library!
I wanted to use it in a project but I'm getting the below error:

https://github.com/amogorkon/fuzzylogic/blob/master/src/fuzzylogic/classes.py#L441

File "C:\Users\myuser\anaconda3\lib\site-packages\fuzzylogic\classes.py", line 420
if (x := min(actual_values[k] for k in K if k in actual_values)) > 0]
^
SyntaxError: invalid syntax

Code

from fuzzylogic.classes import Domain
from fuzzylogic.functions import R, S, alpha

T = Domain("test", 0, 30, res=0.1)

Hey, which Python version are you using? The walrus operator was introduced in 3.8 if I recall correctly..

Hi @amogorkon , thanks for your prompt reply!
Oh yes, indeed I'm using Python 3.7.6
Sadly I can't use fuzzylogic in a project for the moment since I must use Python 3.7 (I have many packages which are not supporting Python 3.8 yet).
Looking forward for using it when possible! Is it planned to support other Python versions?

Hi, I think I used the walrus operator only in one or two places in the whole code. If you like, you can easily replace it with a simple assignment. I would do it for you, but I'm restricted to my mobile phone until next week or so.. I also could approve a PR if you want to make it official.

Hi @amogorkon, sorry for my late reply!
I'd be glad to contribute :) I have a busy week, but I will run some tests the next weekend.
I think it's a good idea to support Python 3.7 since its end of support is planned for 2023-06-27
I can also add a Github Action to run unit tests and check for Python compatibility.

Hey, I'd love to add you as contributor, so you can build that CI tooling. Sadly I can't really help, I'm still restricted to snail internet via mobile phone. Out of curiosity, what's your usecase for fuzzylogic?

Finally got internet again. Switched the walrus op back out, now it should be compatible with 3.7 again, although I couldn't test it on py37 properly.