Re[2]: Re: Mutable Bytes

Lenard Lindstrom <[email protected]> Tue, 27 Jul 2004 08:37:51 -0700 (Pacific Daylight Time)
Newsgroups gmane.comp.lang.prothon.user
Message-ID <Mahogany-0.66.0-4294580231-20040727-095351.00@pop3.norton.antivirus>
On Tue, 27 Jul 2004 17:31:29 +1200 Greg Ewing <[email protected]> wrote:

> Mark Hahn <[email protected]>:
> 
> > OK, once again my brain was malfunctioning.  It was when the def
> > keyword was executed that a copy of the function was made, not when
> > it was called.  The problem had something to do with executing the
> > def more than once.
> 
> It sounds like you need another object here. A Python function
> object has just two attributes, a reference to the function's
> scope, and a reference to a "code object". The code object
> contains the bytecode, plus other info such as the names of
> the parameters and local vars.
> 
The function object also keeps a copy of the name, the doc string and the list
of default argument values (unless that comes under scope?). The defaults will
definitely be part of the function object since a Prothon quick check shows they
are evaluated within the declaration scope and not the calling scope.

Lenard Lindstrom