Re: Re: Mutable Bytes
Greg Ewing <[email protected]> Tue, 27 Jul 2004 17:31:29 +1200
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
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 compiler creates the code object, but no function objects. Each execution of a def statement creates a function object referencing the appropriate code object and enclosing scope. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | [email protected] +--------------------------------------+