Unification of Methods and Functions
Greg Chapman
glc at well.com
Tue May 4 13:08:02 EDT 2004
On Mon, 03 May 2004 11:44:06 -0700, David MacQuigg <dmq at gain.com> wrote:
>It seems to work in Michele Simionato's 'prototype' module.
>{ comp.lang.python, 4/28/04, "Prototypes in Python"} It is global
>only to the called function, but the key requirement is met -- no
>alteration of the standard function calling sequence.
>
>Why can't it be a true global?
If I understand correctly, one drawback of his approach is that methods cannot
rebind globals. A STORE_GLOBAL opcode will store its value into the globs
dictionary created when the method was fetched; this dictionary is not the same
as the module's dictionary, so the changed global will only be visible within
that method (and within that method call: the next time the method is fetched, a
new globs will be created).
---
Greg Chapman
More information about the Python-list
mailing list