[Python-ideas] And now for something completely different
cliff at develix.com
Thu Sep 18 07:40:01 CEST 2008
On Wed, 2008-09-17 at 23:54 -0400, Terry Reedy wrote:
> Cliff Wells wrote:
> > You can accomplish this to some degree by using lambda,
> You can do it completely as far as I know.
> > but I'd much prefer something indicated in the function signature
> > than in the calling code.
> Given Python's nature as a compiled dynamic language, indications are
> really needed in both caller and callee, as at present: pass a function
> and call it. Without an explicit indication at the call site, the
> compiler would have to compile both direct evaluation and function
> object creation and the code to select between them at runtime according
> to an attribute of the function resulting from evaluation of the
> presumed function expression. This would slow *all* function calls,
> which are slow enough already.
Yes, I had this suspicion, but I figured I'd wait for an authority to
make it plain.
However, consider this:
foo ( a + b ) # a + b is compiled but not currently evaluated
Now, clearly Python would need to know at runtime if foo() accepts a
lazy argument prior to calling it, however I'm reminded that Python 3.0
is adding optional static type checking (I believe) which seems to bring
the same issue to the table (and possibly at the same expense you
mention). Would the mechanism not be more or less the same? Check
signature and then apply arguments?
More information about the Python-ideas