Hi David and Paul
Thank you both for your contributions, and for starting a new thread.
David, you wrote
> The need addressed by PEP 505 is real;
I completely agree. My view is that with PEP 505 as it it, the problem
is better than the solution. But all the same, something can be done
to improve matters.
> Moreover, the actual
> legitimate purpose served by the PEP 505 syntax is easily served by existing
> Python simply by using a wrapper class.
I'm with you here also. First explore solving the problem using
existing syntax. If nothing else, it helps us understand the problem.
There's one area where I find attraction in a new syntax. The ??
operator is well described, I think, as a None-aware 'or'. But not in
the name '??'. We all understand
val1 = EXP1 or EXP2
So how about
val2 = EXP1 or-if-None EXP2
with 'or-if-None' being a new language keyword!
> (1) Much more explicit
> (2) Requires no change in syntax
> (3) Will not be a bug magnet
> (4) [Fewer, clear] semantic traps
These are all good goals. And (2) makes exploration much easier.
> The API that could be useful might be something like this:
I have some different ideas, which I'll post later (to this thread, if
you don't mind).
Paul, you wrote
> I would be very interested to hear discussion of the pros and cons of
> adding new syntax to the language as per PEP 505 in comparison to a
> solution like this (ultimately more fleshed out and "production
> quality") rather than comparisons PEP 505 to raw "roll your own"
> Python code.
I like that approach. I find exploration using Python modules to be
more open (democratic?) than syntax changes that require building a
new executable.
Once again, thank you both for starting at the problem and pointing in
a different direction.
--
Jonathan
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/