dbrattli / Expression

Pragmatic functional programming for Python inspired by F#
https://expression.readthedocs.io
MIT License
421 stars 30 forks source link

4.2.0 has invalid python 3.9 syntax #102

Closed mklim closed 1 year ago

mklim commented 1 year ago

Describe the bug https://github.com/cognitedata/Expression/blob/19637ad4b033dc7a454ef7c1bd7164743b782334/expression/core/result.py#L199 uses a match syntax that's only available in python >= 3.10, but the expression package is marked as compatible with python >= 3.9.

To Reproduce

$ python3 --version
Python 3.9.14
$ mkdir /tmp/repro \
      && cd /tmp/repro \
      && python3 -m venv .venv \
      && source .venv/bin/activate
$ pip install expression==4.2.0
$ echo "import expression" >> repro.py
$ python3 repro.py
Traceback (most recent call last):
  File "/private/tmp/repro/repro.py", line 1, in <module>
    import expression
  File "/private/tmp/repro/.venv/lib/python3.9/site-packages/expression/__init__.py", line 11, in <module>
    from . import collections, core, effect
  File "/private/tmp/repro/.venv/lib/python3.9/site-packages/expression/collections/__init__.py", line 4, in <module>
    from . import array, asyncseq, block, map, seq
  File "/private/tmp/repro/.venv/lib/python3.9/site-packages/expression/collections/array.py", line 28, in <module>
    from expression.core import (
  File "/private/tmp/repro/.venv/lib/python3.9/site-packages/expression/core/__init__.py", line 5, in <module>
    from . import aiotools, option, result
  File "/private/tmp/repro/.venv/lib/python3.9/site-packages/expression/core/result.py", line 199
    match other:
          ^
SyntaxError: invalid syntax

And thank you for all your work maintaining this package. :)

dbrattli commented 1 year ago

Thanks for raising this issue. Hope the latest release fixes the problem. Match statements are so awesome that I now use them whenever I can.