Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'subsequent': 0.05; 'subject:Python': 0.06; 'bug.': 0.09; 'lawrence': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'suggest': 0.14; 'changes': 0.15; '10:59': 0.16; 'debugging,': 0.16; 'fly': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nightmare': 0.16; 'undo': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'bit': 0.19; 'trying': 0.19; 'projects,': 0.19; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'fraction': 0.24; 'module,': 0.24; 'cc:2**0': 0.24; 'logging': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; 'easier': 0.31; '25,': 0.31; 'idea,': 0.31; 'class': 0.32; 'figure': 0.32; 'another': 0.32; 'projects.': 0.33; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'method': 0.36; 'being': 0.38; 'does': 0.39; 'bad': 0.39; 'temporarily': 0.60; 'most': 0.60; 'new': 0.61; 'simple': 0.61; 'temporary': 0.65; 'latest': 0.67; 'between': 0.67; 'score': 0.74; '2015': 0.84; 'confusing': 0.84; 'processed,': 0.84; "project's": 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=vJFGu7kzRtc2NaBpy5N+keQHbM7n2Mxqf7v0f6SFQTI=; b=RIPvRA6jFBew2UC4vgNOj6dKAQoDhsLrBbGUmV8kIvYjLgLsF/MTO6E5nmk+ZS3sMQ KGgZCiDRziUBYtt2e+Hg4TsRq3G+stNbOIuqr1EMHXe6VrXmr+9azjmK9bdmCLBLEVOc NIwvebb5qbYe2vvtRzOc1cMwDp2zEwyog2Y1ohBXqAyRGkP6K3kdHce1OFye2qF515YA TsaK0GwP13CUbbfNcsqKpEm9yjuqaVCcHJuH2xZ2lN8SvFKDYqB2lJHWea2m2BtLNx+A DH+/k8HjSd3xvwPJVgBcRR03MUfLAJfnAl2vcX8PMMauFEg/7qwaDc9r4ZwezYXlYDcw bQKg== MIME-Version: 1.0 X-Received: by 10.50.62.110 with SMTP id x14mr9508209igr.2.1422144473901; Sat, 24 Jan 2015 16:07:53 -0800 (PST) In-Reply-To: References: <54C42D9D.7010305@digipen.edu> Date: Sun, 25 Jan 2015 11:07:53 +1100 Subject: Re: Delegation in Python From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422144482 news.xs4all.nl 2894 [2001:888:2000:d::a6]:35560 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:84528 On Sun, Jan 25, 2015 at 10:59 AM, Mark Lawrence wrote: >> You can always "monkey-path" the Fraction class on the fly to add a new >> method to it. I think most would consider this a bad idea, but it does >> work. > > As regards this being a bad idea I'd suggest the latest score is > Practicality 1 Purity 0 :) Indeed. But there's a huge difference between simple and complex projects. I had a bit of a nightmare trying to figure out what was going on with a project's logging... it looked like the Python logging module, but there was another argument being processed, courtesy of some monkey-patching. Try to keep these changes to small projects, where it's easier to keep everything in your head; or for a temporary bit of debugging, where you just want to do this temporarily and then undo it again when you find the bug. Otherwise, it gets confusing for the subsequent reader. ChrisA