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

Random832 random832 at fastmail.com
Fri Oct 2 14:54:46 CEST 2015


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?

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?


More information about the Python-ideas mailing list