Message397459
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, local variables and global variables defined in the current module from acting as constants."""
So your `case Nothing` example is an irrefutable capture pattern that binds the subject to the name "Nothing", while `case Maybe.empty` is a value pattern.
This is probably a little confusing the first time a person sees it, but it is in fact working in compliance with PEP 634, PEP 635, and PEP 636. |
|
Date |
User |
Action |
Args |
2021-07-14 03:31:38 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney, thepabloaguilar |
2021-07-14 03:31:38 | Dennis Sweeney | set | messageid: <1626233498.42.0.591672161301.issue44617@roundup.psfhosted.org> |
2021-07-14 03:31:38 | Dennis Sweeney | link | issue44617 messages |
2021-07-14 03:31:38 | Dennis Sweeney | create | |
|