Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'python.': 0.04; '*not*': 0.05; 'parameter': 0.05; 'bug.': 0.07; 'python': 0.08; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'mutable': 0.09; 'precedence': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'am,': 0.12; 'argument': 0.15; 'alex23': 0.16; 'definition.': 0.16; 'guard': 0.16; 'irrelevant,': 0.16; 'likewise': 0.16; 'subject:=': 0.16; 'language': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'arguments': 0.18; 'programming': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'removed.': 0.24; 'code.': 0.26; "i'm": 0.26; 'function': 0.27; 'asking': 0.28; 'bugs': 0.28; 'pm,': 0.29; 'example': 0.29; '22,': 0.30; 'can.': 0.30; 'concern,': 0.30; 'header:User- Agent:1': 0.33; 'points': 0.34; 'to:addr:python-list': 0.34; 'assignment': 0.34; 'languages': 0.35; 'list.': 0.35; 'but': 0.37; 'received:76': 0.37; 'several': 0.38; 'couple': 0.38; 'should': 0.39; "it's": 0.40; 'to:addr:python.org': 0.40; 'matter': 0.61; 'back': 0.62; 'afraid': 0.63; 'dangerous': 0.64; 'received:websitewelcome.com': 0.64; 'admitted': 0.67; 'received:184': 0.67; 'what,': 0.67; 'camps': 0.84; 'gotcha': 0.84; 'received:gateway14.websitewelcome.com': 0.84; 'rusi': 0.84 Date: Fri, 23 Dec 2011 00:49:45 -0800 From: Ethan Furman User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: python-list@python.org Subject: Re: what does 'a=b=c=[]' do References: <18f78d0d-1e70-4c7b-9033-1422e6edb6db@t13g2000yqg.googlegroups.com> <10c62dac-2750-4f08-8962-21952c1c0a0b@v31g2000prg.googlegroups.com> <5a7a7aab-a320-4429-a130-ffcfcf0ac174@v24g2000prn.googlegroups.com> In-Reply-To: <5a7a7aab-a320-4429-a130-ffcfcf0ac174@v24g2000prn.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: c-76-105-214-227.hsd1.or.comcast.net ([192.168.74.5]) [76.105.214.227]:1136 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 2 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324633913 news.xs4all.nl 6954 [2001:888:2000:d::a6]:54392 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17788 rusi wrote: > On Dec 23, 7:10 am, alex23 wrote: >> On Dec 22, 6:51 pm, Rolf Camps wrote: >> >>> I'm afraid it's dangerous to encourage the use of '[]' as assignment to >>> a parameter in a function definition. If you use the function several >>> times 'default' always points to the same list. >> >> I appreciate the concern, but adding a default argument guard would >> not only obscure the code. It's irrelevant, as you recognise, because >> no matter what, it's going to make copies of the default argument. >> >> You know what the say about foolish consistencies :) > > Programming languages can have bugs as much as programs can. > A classic example is the precedence table of C which Kernighan or > Ritchie (dont remember which) admitted was wrong. > > Likewise function arguments that default to mutable entities is a > known gotcha of python which is best treated as a bug in python. It > should be avoided with the suitable additional circumspection that a > language bug deserves over a program bug. That is the most ridiculous thing I have heard in a while. Mutable default arguments are *not* a bug in Python. Reminds me of a bug report a couple years back claiming multiple inheritence was a bug and asking it to be removed. ~Ethan~