Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: comp.lang.python Subject: Re: monkey patching __code__ Date: Sun, 20 Mar 2016 17:46:22 +0100 Lines: 12 Message-ID: References: <56EBEB5A.7050207@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de O3h3ik4oePyBFmTjEl2Tkg52ROjQW3+vcNQ8KB0k2QFA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.055 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'defaults': 0.05; 'imported': 0.09; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'function,': 0.22; 'seems': 0.23; 'header:In- Reply-To:1': 0.24; 'updating': 0.27; 'function': 0.28; 'code': 0.30; 'received:10.0': 0.34; 'best,': 0.35; 'but': 0.36; 'modules': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'end': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'injecting': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1458492384; bh=tW9mSH6OupgThyJdgZ2OrlBgt8xNpeivBPly1W0tsEk=; h=Subject:To:References:From:Date:In-Reply-To:From; b=Qu2EOURb+6sTv446ElL9cRansIiCtwva0dsGzgvxwvvJJ3EKRHxJcBo/81p9IcDUu 43rAa8+288gXpyaIRaNfMnHFb2msYOta1XilLZfVlMPcAMl2LK7fY0u7ZuV/tIr9qm yVyltb7qaP3CyHcqksaH73syHhEyZR+QDejdpgkk= In-Reply-To: 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: 397 X-purgate-ID: 154282::1458492384-00004575-A8FECB8A/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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105305 On 19.03.2016 00:58, Matt Wheeler wrote: > I know you have a working solution now with updating the code & > defaults of the function, but what about just injecting your function > into the modules that had already imported it after the > monkeypatching? > > Seems perhaps cleaner, unless you'd end up having to do it to lots of modules... Why do you consider it cleaner? Best, Sven