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


Groups > comp.lang.python > #9123

Re: What makes functions special?

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: What makes functions special?
References <mailman.805.1310246946.1164.python-list@python.org> <87sjqfgjqg.fsf@benfinney.id.au> <mailman.807.1310253381.1164.python-list@python.org>
Date 2011-07-10 10:38 +1000
Message-ID <87mxgngebf.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


Eric Snow <ericsnowcurrently@gmail.com> writes:

> On Sat, Jul 9, 2011 at 4:41 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> > Eric Snow <ericsnowcurrently@gmail.com> writes:
> >> No other objects have code objects. No other objects in Python have
> >> this special optimization.
> >
> > Yes. The two facts are directly related.
[…]

> > Yes, functions are different and are treated differently. What's
> > your question?
>
> My point is that functions are special in Python because they provide
> a built in optimization via the special execution of code objects.

Functions are special because they define a code object.

> I would like to know if it is really that big a deal

Is *what* really that big a deal?

Perhaps this could be clearer if you'd describe what it is that
surprises you, and how you'd expect it to be different.

> and if the optimized execution of code objects is a CPython
> implementation detail or a specification of the language.

I don't know that it's a specification. But functions result in code
objects, and other statements don't; I am not seeing why treating them
differently is surprising.

-- 
 \          “I see little commercial potential for the Internet for at |
  `\                               least ten years.” —Bill Gates, 1994 |
_o__)                                                                  |
Ben Finney

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


Thread

What makes functions special? Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-09 15:28 -0600
  Re: What makes functions special? Ben Finney <ben+python@benfinney.id.au> - 2011-07-10 08:41 +1000
    Re: What makes functions special? Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-09 17:16 -0600
      Re: What makes functions special? Ben Finney <ben+python@benfinney.id.au> - 2011-07-10 10:38 +1000
        Re: What makes functions special? Eric Snow <ericsnowcurrently@gmail.com> - 2011-07-09 19:28 -0600

csiph-web