Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail 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; 'programmer': 0.03; 'argument': 0.05; 'mrab': 0.05; '21,': 0.07; 'explicit': 0.07; 'arguments,': 0.09; 'falls': 0.09; 'friday,': 0.09; 'thus,': 0.09; 'python': 0.11; 'assume': 0.14; 'confuse': 0.16; 'docs.': 0.16; 'fits': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; "he'll": 0.16; 'hell.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'mutable': 0.16; 'rules.': 0.16; 'throw': 0.16; 'unexpectedly': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'differ': 0.19; 'pieces': 0.19; 'header:User-Agent:1': 0.23; 'passes': 0.24; 'mention': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'code': 0.31; 'implicit': 0.31; 'omitted': 0.31; 'could': 0.34; 'johnson': 0.35; 'responsible': 0.36; 'should': 0.36; 'too': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'balance': 0.61; 'skip:* 10': 0.61; "you've": 0.63; 'between': 0.67; 'header:Reply-To:1': 0.67; 'reads': 0.68; 'default': 0.69; 'reply-to:no real name:2**0': 0.71; 'enjoy': 0.71; 'lives': 0.74; 'sole': 0.78; 'blown': 0.84; 'buddies': 0.84; 'rage.': 0.84; 'reply-to:addr:python.org': 0.84; 'subject:Value': 0.84; 'gift': 0.85; 'rick': 0.93; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=KrN0hwmN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=Mpz3XJYojt8A:10 a=cv5P745OSh2x6Pb7ZO8A:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Fri, 21 Jun 2013 23:49:51 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Default Value References: <7e6361d5-6619-4aaa-adda-8b5f01bde57f@googlegroups.com> <447dd1c6-1bb2-4276-a109-78d7a067b442@d8g2000pbe.googlegroups.com> <2e92b4c7-31be-40d2-a906-ab19f3630dfa@googlegroups.com> <51c477dd$0$29999$c3e8da3$5496439d@news.astraweb.com> <565a1c8f-6fd9-4bab-9834-076eaea527f8@googlegroups.com> <7e1ed740-df18-4978-b11d-8ca9c4b5bd04@googlegroups.com> <03e9544e-9d6d-4155-a793-56f0c22c7f7a@googlegroups.com> In-Reply-To: <03e9544e-9d6d-4155-a793-56f0c22c7f7a@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371854996 news.xs4all.nl 15881 [2001:888:2000:d::a6]:56284 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48889 On 21/06/2013 21:44, Rick Johnson wrote: > On Friday, June 21, 2013 2:25:49 PM UTC-5, MRAB wrote: >> On 21/06/2013 19:26, Rick Johnson wrote: >> > ============================================================ >> > The Apathetic Approach: >> > ============================================================ >> > I could just assume that a programmer is responsible for the >> > code he writes. If he passes mutables into a function as >> > default arguments, and then mutates the mutable later, too >> > bad, he'll understand the value of writing solid code after >> > a few trips to exception Hell. >> > ============================================================ >> > The Malevolent Approach (disguised as beneva-loon-icy): >> > ============================================================ >> > I could use early binding to confuse the hell out of him and >> > enjoy the laughs with all my ivory tower buddies as he falls >> > into fits of confusion and rage. Then enjoy again when he >> > reads the docs. Ahh, the gift that just keeps on giving! >> >> How does the "Apathetic Approach" differ from the >> "Malevolent Approach"? > > In the apathetic approach i allow the programmer to be the > sole proprietor of his own misfortunes. He lives by the > sword, and thus, he can die by the sword. > > Alternatively the malevolent approach injects misfortunes > for the programmer on the behalf of esoteric rules. In this > case he will live by sword, and he could die by the sword, > or he could be unexpectedly blown to pieces by a supersonic > Howitzer shell. > > It's an Explicit death versus an Implicit death; and Explicit > should ALWAYS win! > > The only way to strike a reasonable balance between the > explicit death and implicit death is to throw up a warning: > > "INCOMING!!!!" > > Which in Python would be the "MutableArgumentWarning". > > *school-bell* > I notice that you've omitted any mention of how you'd know that the argument was mutable.