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


Groups > comp.lang.python > #9120

Re: What makes functions special?

References <mailman.805.1310246946.1164.python-list@python.org> <87sjqfgjqg.fsf@benfinney.id.au>
Date 2011-07-09 17:16 -0600
Subject Re: What makes functions special?
From Eric Snow <ericsnowcurrently@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.807.1310253381.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jul 9, 2011 at 4:41 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> Eric Snow <ericsnowcurrently@gmail.com> writes:
>
>> A tracker issue [1] recently got me thinking about what makes
>> functions special.
>
> As you describe, functions are special for your scenario because a
> function definition needs to result in executable code as an object.
>
>> Definition time actually happens during compile time, but it has its
>> own label to mark the contrast with execution time. So why do
>> functions get this special treatment?
>
> You answer this question.
>
>> No other objects have code objects. No other objects in Python have
>> this special optimization.
>
> Yes. The two facts are directly related.
>
>> Maybe I am missing something, or maybe it is super obvious, but isn't
>> this a critical point?
>
> What is the crisis (“a stark change from one state to another”) that
> you're referring to by “a critical point”?
>
> Yes, functions are different and are treated differently. What's your
> question?
>
>> From the docs, the code objects in of function objects are the latter,
>> but the optimization expectation is not clearly indicated. Are there
>> other motivations behind code objects that I am missing? Am I wrong
>> about the optimization expectation?
>
> What optimisation expectation?
>
>> Thoughts?
>
> I think yours need to be expressed more explicitly; I'm not seeing the
> issue that concerns you.
>

My point is that functions are special in Python because they provide
a built in optimization via the special execution of code objects.  I
would like to know if it is really that big a deal, and if the
optimized execution of code objects is a CPython implementation detail
or a specification of the language.

-eric

> --
>  \        “The reason we come up with new versions is not to fix bugs. |
>  `\                     It's absolutely not.” —Bill Gates, 1995-10-23 |
> _o__)                                                                  |
> Ben Finney
> --
> http://mail.python.org/mailman/listinfo/python-list
>

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