set built-in func_code?
Gerhard Häring
gh at ghaering.de
Tue Sep 9 05:21:54 EDT 2003
Gerhard Häring wrote:
> Birgit Rahm wrote:
>> I want to set the built-in func_code in my function, how can I does
>> this in the correct way?
>
> I don't think that's possible for an existing function object. [...]
Well, maybe I should try before I post:
#v+
>>> def f(): print 5
...
>>> def g(): print 6
...
>>> f.func_code = g.func_code
>>> f()
6
#v-
This is an unnecessary hack, IMO. Hacks aren't bad, but unecessary ones
are, IMO. Still, what are you trying to achieve?
-- Gerhard
More information about the Python-list
mailing list