Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105523 > unrolled thread
| Started by | dieter <dieter@handshake.de> |
|---|---|
| First post | 2016-03-23 09:24 +0100 |
| Last post | 2016-03-23 09:24 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: monkey patching __code__ dieter <dieter@handshake.de> - 2016-03-23 09:24 +0100
| From | dieter <dieter@handshake.de> |
|---|---|
| Date | 2016-03-23 09:24 +0100 |
| Subject | Re: monkey patching __code__ |
| Message-ID | <mailman.37.1458721466.2244.python-list@python.org> |
"Sven R. Kunze" <srkunze@mail.de> writes: > ... > As far as I can see, the code replacement approach solves the problem > once and for all. Thus is far more stable. > > Manually finding out every single module that might or might not have > imported "reverse" before we could monkeypatch it might result in a > maintenance nightmare (just think about a Django upgrade). But you have observed that you cannot do everything with a code substitution: a function call does not only depend on the code but also on other properties of the function object: e.g. the parameter processing. You might be able to change them in a similar way as "__code__" (i.e. direct modification). Otherwise, you would need to construct a new "function object" -- and lose the possibility to completely change the function object in place.
Back to top | Article view | comp.lang.python
csiph-web