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


Groups > comp.lang.python > #9154

Re: What makes functions special?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'suppose': 0.05; 'interpreter': 0.07; 'python': 0.08; 'difference,': 0.09; 'loop.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'wrote:': 0.15; '*only*': 0.16; 'compiler,': 0.16; 'pm,': 0.16; "wouldn't": 0.17; 'loop': 0.22; 'header:In-Reply-To:1': 0.22; 'compiled': 0.23; 'code': 0.24; 'byte': 0.25; 'interpret': 0.29; 'subject:?': 0.31; 'source': 0.32; 'does': 0.32; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'instead': 0.34; 'header:User- Agent:1': 0.34; '(as': 0.34; 'function.': 0.35; 'subject:What': 0.35; 'functions.': 0.37; 'opposed': 0.37; 'received:cox.net': 0.37; 'but': 0.37; 'using': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'question,': 0.38; 'steven': 0.38; 'header:Mime- Version:1': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'did': 0.40; 'your': 0.60; 'bodies': 0.67
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: What makes functions special?
Date Sun, 10 Jul 2011 00:04:20 -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>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host wsip-72-214-0-82.sd.sd.cox.net
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To <4e1901bb$0$29994$c3e8da3$5496439d@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.830.1310281526.1164.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310281526 news.xs4all.nl 21829 [2001:888:2000:d::a6]:58286
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9154

Show key headers only | 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