[issue44617] Undesired Behavior on `match` using Singleton object

2021-08-04 Thread Brandt Bucher
Brandt Bucher added the comment: Yep, everything is working as intended here. Thanks, Dennis, for taking the time to explain why. Pablo, if you're still unsure of why your examples behave the way they do, I strongly recommend reading through the official tutorial (PEP 636). It goes through

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-14 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +brandtbucher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-13 Thread Dennis Sweeney
Dennis Sweeney added the comment: >From https://www.python.org/dev/peps/pep-0635/#value-patterns : """We therefore only adopted the rule that any dotted name (i.e., attribute access) is to be interpreted as a value pattern, for example HttpStatus.OK above. This precludes, in particular,

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-13 Thread Pablo Aguilar
Pablo Aguilar 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:

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-13 Thread Pablo Aguilar
Pablo Aguilar added the comment: But, `Maybe.empty` works like a `Literal Pattern` or `Constant Pattern`? -- ___ Python tracker ___

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-13 Thread Dennis Sweeney
Dennis Sweeney added the comment: This code... match my_maybe: case Maybe.empty: print('FIRST CASE') case _: print('DEFAULT CASE') ... is roughly equivalent to this code: if my_maybe == Maybe.empty: print('FIRST CASE') case _:

[issue44617] Undesired Behavior on `match` using Singleton object

2021-07-12 Thread Pablo Aguilar
New submission from Pablo Aguilar : Hey, I'm not sure if this is really a bug but I'd like to show to prevent some undesired behavior! I'm working in the `match` support for returns (https://github.com/dry-python/returns) library when I saw a behavior similar to the described in `Constant