Author Dennis Sweeney
Recipients Dennis Sweeney, thepabloaguilar
Date 2021-07-14.03:31:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626233498.42.0.591672161301.issue44617@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-07-14 03:31:38Dennis Sweeneysetrecipients: + Dennis Sweeney, thepabloaguilar
2021-07-14 03:31:38Dennis Sweeneysetmessageid: <1626233498.42.0.591672161301.issue44617@roundup.psfhosted.org>
2021-07-14 03:31:38Dennis Sweeneylinkissue44617 messages
2021-07-14 03:31:38Dennis Sweeneycreate