Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105572
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "Sven R. Kunze" <srkunze@mail.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: monkey patching __code__ |
| Date | Wed, 23 Mar 2016 23:06:01 +0100 |
| Lines | 20 |
| Message-ID | <mailman.69.1458770767.2244.python-list@python.org> (permalink) |
| References | <56EBEB5A.7050207@mail.de> <CAG93HwGKrN8y3k=3OFtHq-PbMjFzy=1U99-ZuJOLdEq69gosfg@mail.gmail.com> <56EED3DE.7050101@mail.de> <CAG93HwFr-yFqjex_U4yZs5WUuLCCbCJDJfso2Kp6G0F3BdKOZQ@mail.gmail.com> <56F13417.8060108@mail.de> <87egb1vbyn.fsf@handshake.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de NqL1Kth53sy23R+2bCNe5A1P8GDPdS7UGl2lG/GwXbEQ== |
| Return-Path | <srkunze@mail.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.122 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.76; '*S*': 0.00; 'processing.': 0.07; 'python': 0.10; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'otherwise,': 0.20; 'parameter': 0.22; 'implemented': 0.24; 'properties': 0.24; 'header:In-Reply-To:1': 0.24; 'possibility': 0.27; 'function': 0.28; 'actual': 0.28; 'that.': 0.30; 'code': 0.30; 'e.g.': 0.30; 'similar': 0.33; 'changing': 0.34; 'except': 0.34; 'received:10.0': 0.34; 'so,': 0.35; 'best,': 0.35; 'but': 0.36; '(i.e.': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'means': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'us.': 0.62; 'charset:windows-1252': 0.62; 'lose': 0.63; 'direct': 0.68; 'construct': 0.84; 'object:': 0.84; 'observed': 0.84; "that'll": 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1458770765; bh=AB9lQeigZoq21ionJfKOjDohB8L1IfXRyc9u1h/XCNE=; h=Subject:To:References:From:Date:In-Reply-To:From; b=FC9A7HePfpL9UabCFfSEGU8JfOa82DuOfld4hAIVqCFRqFWB7lYVZfkzh6ChQQG8m GWfGjIv8ErTZ7s8/fwmta6hnyiMxDKLbgkXqxmLYP64jN+hGctKJfb+DZE2yvjQHk9 A76GNNn086WAjbBHkobMnrIjMqIA7fmrhuzKqy6k= |
| In-Reply-To | <87egb1vbyn.fsf@handshake.de> |
| X-purgate | clean |
| X-purgate | This mail is considered clean (visit http://www.eleven.de for further information) |
| X-purgate-type | clean |
| X-purgate-Ad | Categorized by eleven eXpurgate (R) http://www.eleven.de |
| X-purgate | This mail is considered clean (visit http://www.eleven.de for further information) |
| X-purgate | clean |
| X-purgate-size | 834 |
| X-purgate-ID | 154282::1458770763-00003BBD-519C8D66/0/0 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:105572 |
Show key headers only | View raw
On 23.03.2016 09:24, dieter wrote: > 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. Yep, that's because Python is very flexible and provides means for changing even that. So, it's not part of the __code__ object but part of the actual function. That's okay. > 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. Exactly. Except __globals__ we are all set and I think that'll work for us. I will report once we've implemented it that way. Best, Sven
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: monkey patching __code__ "Sven R. Kunze" <srkunze@mail.de> - 2016-03-23 23:06 +0100
csiph-web