Re: Observations on the three pillars of Python execution

2011-08-05 Thread Steven D'Aprano
Eric Snow wrote: > On Fri, Aug 5, 2011 at 11:29 AM, Steven D'Aprano > wrote: [...] >> Do you believe that this process of generating a code object and throwing >> it away is a part of the Python language specification, which any >> compiler must do in order to call itself "Python", or a mere >> i

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Steven D'Aprano
Mel wrote: > Steven D'Aprano wrote: > >> There may be some other obscure built-in type that includes code objects, >> but I can't imagine what it would be. I feel confident in saying that >> functions, and functions alone, contain code. Even methods are just >> wrappers around functions. Even bui

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Eric Snow
On Fri, Aug 5, 2011 at 11:29 AM, Steven D'Aprano wrote: > Eric Snow wrote: > >> On Fri, Aug 5, 2011 at 8:36 AM, Steven D'Aprano >> wrote: >>> Eric Snow wrote: >>> In Python, three types of objects have special syntax and mechanics for their instantiation, during which a code object is g

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Terry Reedy
On 8/5/2011 4:22 AM, Thomas Jollans wrote: On 05/08/11 09:20, Eric Snow wrote: Object available during code object execution: (M) no (C) no (F) no (F) yes. cf. recursion. Recursion only happens through runtime name resolution, not through direct access to the function or code object from wi

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Mel
Steven D'Aprano wrote: > There may be some other obscure built-in type that includes code objects, > but I can't imagine what it would be. I feel confident in saying that > functions, and functions alone, contain code. Even methods are just > wrappers around functions. Even built-in functions like

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Steven D'Aprano
Eric Snow wrote: > On Fri, Aug 5, 2011 at 8:36 AM, Steven D'Aprano > wrote: >> Eric Snow wrote: >> >>> In Python, three types of objects have special syntax and mechanics >>> for their instantiation, during which a code object is generated: >>> modules, classes, and functions. >> >> I believe you

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Eric Snow
On Fri, Aug 5, 2011 at 8:36 AM, Steven D'Aprano wrote: > Eric Snow wrote: > >> In Python, three types of objects have special syntax and mechanics >> for their instantiation, during which a code object is generated: >> modules, classes, and functions. > > I believe you are labouring under a misapp

Re: Recursive functions (was Re: Observations on the three pillars of Python execution)

2011-08-05 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Aug 5, 2011 at 9:22 AM, Thomas Jollans wrote: >> On 05/08/11 09:20, Eric Snow wrote: >>> Object available during code object execution: >>> (M) no >>> (C) no >>> (F) no >> (F) yes. >> >> cf. recursion. > > Is it? As I understand it, a Python function is not able t

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Steven D'Aprano
Eric Snow wrote: > In Python, three types of objects have special syntax and mechanics > for their instantiation, during which a code object is generated: > modules, classes, and functions. I believe you are labouring under a misapprehension. Modules and classes don't generate code objects. Th

Recursive functions (was Re: Observations on the three pillars of Python execution)

2011-08-05 Thread Chris Angelico
On Fri, Aug 5, 2011 at 9:22 AM, Thomas Jollans wrote: > On 05/08/11 09:20, Eric Snow wrote: >> Object available during code object execution: >> (M) no >> (C) no >> (F) no > (F) yes. > > cf. recursion. Is it? As I understand it, a Python function is not able to reference "itself" but must referen

Re: Observations on the three pillars of Python execution

2011-08-05 Thread Thomas Jollans
On 05/08/11 09:20, Eric Snow wrote: > Object available during code object execution: > (M) no > (C) no > (F) no (F) yes. cf. recursion. -- http://mail.python.org/mailman/listinfo/python-list

Observations on the three pillars of Python execution

2011-08-05 Thread Eric Snow
In Python, three types of objects have special syntax and mechanics for their instantiation, during which a code object is generated: modules, classes, and functions. Each has its own role to play and the differences between them mostly reflect that. Here are some observations (based on default b