João Neves wrote: > On 2 Abr, 21:38, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> On Wed, Apr 2, 2008 at 2:33 PM, João Neves <[EMAIL PROTECTED]> wrote: >>> On Apr 2, 5:41 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: >>> > > The thing I've been wondering is why _is_ it read-only? In what >>> > > circumstances having write access to co_code would break the language >>> > > or do some other nasty stuff?.... >> There is no need to overwrite co_code. Create a new code object with >> your desired bytecode and use that instead. > > Yes, it may work (haven't tested - isn't there any problem with stuff > like co_name, for instance?), but for simplicity's sake, wouldn't it > be far more convenient if you could just write over co_code? :) > In the end, it's all a matter of convenience, I guess.
Nope: If you change the code in-place, the whole stack's references to where they were running would need to get updated to corresponding locations in the new code. _That_ is a lot of work. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list