Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?) Date: Thu, 26 Nov 2015 00:52:55 +0000 (UTC) Lines: 21 Message-ID: References: <87d1v5emhl.fsf@elektro.pacujo.net> <564e6a62$0$1620$c3e8da3$5496439d@news.astraweb.com> <56556DF8.1080407@rece.vub.ac.be> <878u5mns8z.fsf@elektro.pacujo.net> <858u5lc0r7.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de RgojcZ7HHGdLpa+AZaMpMwFqC41ePzFCnX07EtdI1sDg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'immutable': 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; 'tuple': 0.09; 'python': 0.10; 'subject: \n ': 0.15; '(2,': 0.16; '(3,': 0.16; '[2,': 0.16; 'describing': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subject:?)': 0.16; 'tuple;': 0.16; 'wrote:': 0.16; 'not,': 0.22; '(or': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'not.': 0.27; 'right.': 0.27; 'sequence': 0.27; 'received:comcast.net': 0.33; 'lists': 0.34; 'list': 0.34; 'gives': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; '(i.e.': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:org': 0.37; 'list.': 0.37; 'difference': 0.38; 'mean': 0.38; 'means': 0.39; 'does': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'different': 0.63; 'between': 0.65; '8bit%:21': 0.70; 'skip:\xe2 10': 0.70 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: slrn/pre1.0.3-7 (Linux) 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:99514 On 2015-11-25, Ben Finney wrote: > That is, the ‘2’ in ‘cartesian_point = (2, 3)’ means something different > than in ‘cartesian_point = (3, 2)’. > > Whereas the ‘2’ in ‘test_scores = [2, 3]’ means exactly the same as in > ‘test_scores = [3, 2]’. > > If each position in the sequence gives the value there a different > menaning, use a tuple; if not, use a list. I don't think that's really right. The absence of first-class multisets in python does mean that lists get "abused" for that purpose, but I don't think that means that there's no legitimate use-case for a list (i.e. a mutable sequence in which position is significant). The difference between a tuple and a list is that one is mutable and the other is not. The difference you are describing is between a list and a multiset (or a tuple and an immutable multiset).