Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Dennis Lee Bieber Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Fri, 20 Nov 2015 08:34:18 -0500 Organization: IISS Elusive Unicorn Lines: 20 Message-ID: References: <564dbe6b$0$1610$c3e8da3$5496439d@news.astraweb.com> <564df258$0$1604$c3e8da3$5496439d@news.astraweb.com> <564e71f6$0$1619$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de SRGOpHzVJAG/hgNtQ4C2VwJcKoMymN3WeXjza6ozrzgw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'compiler': 0.05; 'variable,': 0.07; 'literal': 0.09; 'message-id:@4ax.com': 0.09; 'mutable': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '>that': 0.16; 'anyway).': 0.16; 'no...': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'substitute': 0.16; "wouldn't": 0.16; 'url:home': 0.18; '2015': 0.20; 'parser': 0.22; 'header:X -Complaints-To:1': 0.26; 'fri,': 0.27; 'point': 0.33; 'surprised': 0.33; 'list': 0.34; 'behind': 0.35; 'nov': 0.35; '(and': 0.36; 'assigned': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'doing': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'ever': 0.60; 'effective': 0.63; 'results': 0.66; 'dennis': 0.91; 'scenes': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: adsl-108-79-217-215.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:99148 On Fri, 20 Nov 2015 12:39:58 +0000, BartC declaimed the following: >* The persistent nonsense that somehow [] is mutable (what happens is >that [] is assigned to a variable, and /that/ is mutable) (And I will >probably get some flak now because 'assign' and 'variable' are >meaningless in Python!) > No... [] is a literal to the compiler which results in the compiler generating a list OBJECT /at the point where the [] was encountered/. That object is bound to some name. The name is not mutable, only the contents of the generated object are mutable. You can substitute list() where ever you use [] with no effective change in the semantics. (I wouldn't be surprised if the parser was doing that behind the scenes anyway). -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/