aroberge / ideas

Easy creation of custom import hooks to experiment on alternatives to Python's syntax; see https://aroberge.github.io/ideas/docs/html/
Other
76 stars 5 forks source link

PEP 505 -- None-aware operators #3

Open aroberge opened 4 years ago

aroberge commented 4 years ago

PEP 505 proposes to use ? and ?? as new syntax element to create compact expressions dealing with identifiers that could have a value of None.

maybe() from sorcery as well as maybe() from pymaybe appear to have implemented a similar functionality through function calls instead of the proposed and currently invalid Python syntax described in PEP 505.

It might be possible to write an import hook that would convert the proposed syntax into calls to one of the existing maybe() functions, thus allowing one to experiment with the proposed syntax.