Dennis Sweeney <sweeney.dennis...@gmail.com> 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, 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44617>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to