Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9128
| References | <mailman.805.1310246946.1164.python-list@python.org> <87sjqfgjqg.fsf@benfinney.id.au> <mailman.807.1310253381.1164.python-list@python.org> <87mxgngebf.fsf@benfinney.id.au> |
|---|---|
| Date | 2011-07-09 19:28 -0600 |
| Subject | Re: What makes functions special? |
| From | Eric Snow <ericsnowcurrently@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.812.1310261284.1164.python-list@python.org> (permalink) |
On Sat, Jul 9, 2011 at 6:38 PM, Ben Finney <ben+python@benfinney.id.au> wrote: > 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. > Right. But the point is that the code objects (in CPython at least) allow a special execution of the function body. What does that special execution give us? I am guessing a sufficient performance increase. Is there anything else? And do other Python implementations do anything special with code objects? I am not questioning why it was done a certain way, but rather trying to understand how Python works. >> 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. > I don't have any unexpected failure that I ran into or anything like that. I am just trying to learn more about the ins and outs of Python and that tracker issue got me thinking. And I know that there are plenty of people on this list that know a lot more about Python than I do. :) So I thought I would ask (in my own obscure way) if I was understanding the definition/execution model correctly. Sorry for any confusion. -eric >> 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 > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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