encukou
(Petr Viktorin)
5
Thank you for the PEPs! These do look like the best version of the proposal. Best of luck with the PEP process!
(I’m -0; I don’t run into needing this often enough.)
The PEP mentions the projects glom, jmespath, nonesafe, pymaybe. Did contact their authors/maintainers for feedback or endorsement? It’s good to pull someone in the discussion if you mention them.
The No-Value Protocol rejected idea should probably mention PEP 661 sentinels – an official generalization of None that doesn’t have math.nan’s issues. (I still prefer the crisp “None only” rule, though: sentinels are only meant for cases where None isn’t enough; writing out None if x is MISSING else x.foo is nice and explicit.)
Note that IPython uses ? (and ??) for accessing help, and it’s very popular/useful there. CPython’s REPL has been getting non-Python syntax (like help without parentheses), and we might want ? for that purpose too.
IPython doesn’t allow ? with arbitrary expressions, but I’ve sometimes wanted to be able to use it that way. So, to me, this expression from the PEP’s Motivation reads as “I want to get help on data.customer”:
data.customer?.user.name.lower()
I don’t have a concrete proposal in this area, but PEP 823 does limit future options.
Both PEPs cover this. From PEP 823:
the coalescing operators were moved into a separate document, see PEP 824. Both proposals can be adopted independently of each other.
2 Likes