[issue44617] Undesired Behavior on `match` using Singleton object
Pablo Aguilar
report at bugs.python.org
Tue Jul 13 22:31:59 EDT 2021
Pablo Aguilar <pablo.aguilar at fatec.sp.gov.br> added the comment:
In fact, I'm worried about how to explain some behaviors.
Look here:
```python
# `Maybe` here is the same class described in the first message
Nothing = Maybe()
Maybe.empty = Nothing
if __name__ == '__main__':
my_maybe = Maybe()
match my_maybe:
case Nothing:
print('FIRST CASE')
case _:
print('DEFAULT CASE')
```
I can't use `Nothing` to match the values even though it's a variable but using `Maybe.empty` it works.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44617>
_______________________________________
More information about the Python-bugs-list
mailing list