[Python-ideas] PEP 505 (None coalescing operators) thoughts

Ryan Gonzalez rymg19 at gmail.com
Fri Oct 2 16:13:19 CEST 2015



On October 2, 2015 7:54:46 AM CDT, Random832 <random832 at fastmail.com> wrote:
>On Fri, Oct 2, 2015, at 06:01, Ron Adam wrote:
>> On 10/01/2015 04:12 PM, Random832 wrote:
>> > On Thu, Oct 1, 2015, at 16:57, Ron Adam wrote:
>> >> >And to go out on a limb...;-)
>> >> >
>> >> >Another possibility is to have a*special magic callable*  that
>when
>> >> >called skips the argument evaluation and returns None.
>> 
>> > That's dangerous talk indeed. Special magic callables are Lisp
>> > territory.;)
>> 
>> It's also lambda calculus territory.
>
>Does lambda calculus really have a notion of two types of function that
>are called with the same syntax but one receives the values as they
>have
>been evaluated and the other receives some abstract representation of
>how to get them if it needs them? That doesn't even make any sense.
>Does
>it even have a notion of side effects and therefore when/whether things
>are evaluated if they are not needed?
>

Indeed. Lambda calculus is untyped...

>Not everything in Lisp is in lambda calculus.
>
>> I realized this evening the parser doesn't need to know at parse
>time, 
>> and the object doesn't need to be special.  It's the syntax that
>gives 
>> it the specialness, not the object.  So what I was thinking is still 
>> possible, but it would work more like the other suggestions.
>> 
>> If you look at byte code generated for a function call...
>> 
>> You will notice the function is loaded on the stack *before* the 
>> argument expressions are evaluated.
>> 
>> It won't require generating lamba expressions, just a conditional
>jump 
>> where '?(' is used.  So no, it won't be required at every call site.
>
>What does this have to do with the idea of a magic callable? If this is
>implemented with a magic callable then A) *any* callable might be a
>magic callable and B) the idea original idea strongly implied a
>generalized notion of magic callables, of which NoneCall would be only
>one example. How do you pass the arguments to the *other* magic
>callables that *do* [maybe] evaluate them?
>
>You've basically just explained how the bytecode works for ?( if it is
>*not* implemented with a magic callable. So how does making it NoneCall
>instead of just None improve anything?
>_______________________________________________
>Python-ideas mailing list
>Python-ideas at python.org
>https://mail.python.org/mailman/listinfo/python-ideas
>Code of Conduct: http://python.org/psf/codeofconduct/

-- 
Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.


More information about the Python-ideas mailing list