Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: modifying a standard module? Date: Fri, 12 Feb 2016 16:21:30 -0800 Organization: A noiseless patient Spider Lines: 11 Message-ID: <87bn7lcved.fsf@nightsong.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="560a36ee31cc4bcf69e115b311f0cc5c"; logging-data="3618"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ax9Bt9B3uWychoWPY1cA2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:N4+1W0ZoFLkoKt0s0NWP7hb8vZc= sha1:JAdX9y4YcUExssRXdLl96UlAoLk= Xref: csiph.com comp.lang.python:102877 Ulli Horlacher writes: >> tarfile.TarFile.extractall = new_extractall > > This is more easy than I could imagined :-) It is in my Python notes, > now. This is called "duck punching" or "monkey patching" and sometimes it's necessary, but it's something of an antipattern since the module could change under you between versions, and that sort of thing. If you have to do it, then fine; but if you have a choice, it's preferable to avoid that sort of thing.