Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9154

Re: What makes functions special?

From Terry Reedy <tjreedy@udel.edu>
Subject Re: What makes functions special?
Date 2011-07-10 00:04 -0700
References <CALFfu7Cd4jmZGfCPpz58Me+ar5w4O02x1TN9AtSMtkTK11Bsqg@mail.gmail.com> <ivarbq$g20$1@dough.gmane.org> <mailman.811.1310260259.1164.python-list@python.org> <4e1901bb$0$29994$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.830.1310281526.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 7/9/2011 6:34 PM, Steven D'Aprano wrote:

> Suppose instead an implementation of Python did not pre-compile the
> function. Each time you called spam(n), the implementatio n would have to
> locate the source code and interpret it on the spot. Would that be
> allowed?"
>
> If that's your question, then I would call that a Python interpreter using
> c.1960 technology (as opposed to a byte-code compiler, which all the main
> implementations currently are).
>
> If that were the *only* difference, then I see no reason why it wouldn't be
> allowed as an implementation of Python. A horribly slow implementation, but
> still an implementation.

while and for loops would also be terribly slow if their bodies were not 
compiled but were reinterpreted at the source code level for each loop. 
Having to reinterpred the compiled byte code for each loop does make 
them slower than compiled to native code C. Same as for functions.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: What makes functions special? Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-09 19:10 -0600
  Re: What makes functions special? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-10 11:34 +1000
    Re: What makes functions special? Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-09 20:33 -0600
    Re: What makes functions special? Terry Reedy <tjreedy@udel.edu> - 2011-07-10 00:04 -0700

csiph-web