Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Antoon Pardon Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Tue, 24 Nov 2015 22:25:18 +0100 Lines: 29 Message-ID: References: <8601c9af-a7d9-4642-ba1c-8edd1e4c3390@googlegroups.com> <56546985.8060704@rece.vub.ac.be> <56547337.4000709@rece.vub.ac.be> <56547C53.8030407@rece.vub.ac.be> <5654864E.2070906@rece.vub.ac.be> <56549324.8020607@rece.vub.ac.be> <56549F15.40206@rece.vub.ac.be> <5654B037.6020107@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 5Umo0gX/nxPpEmetHoPN+gO1NoUT0JF5ogVv4GnEk0Nw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'compiler': 0.05; 'differently': 0.07; 'tuple': 0.09; '32,': 0.16; '42,': 0.16; '42.': 0.16; 'constants': 0.16; 'literal,': 0.16; 'negation': 0.16; 'received:adsl-dyn.isp.belgacom.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'language': 0.19; '>>>': 0.20; 'constant': 0.22; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'received:192.168.1.3': 0.29; 'code': 0.30; 'received:be': 0.30; 'point': 0.33; 'picking': 0.33; 'true.': 0.33; 'could': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'loaded': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'sure': 0.39; 'received:192': 0.39; 'build': 0.40; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'matter': 0.63; 'needing': 0.63; 'detail.': 0.66; 'reverse': 0.66; '13)': 0.84; 'extra.': 0.84; 'pardon': 0.84; 'received:195.238': 0.84; 'schreef': 0.84; 'hand,': 0.97 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CZAQAC1VRW/9Xi9VENUcUwgz2CUgKBfhEBAQEBAQEBhT8BAQR4EQsYCRYPCQMCAQIBRRMIAogvrHCMc4QjAQEBBwIBIIZUhH6FJ4QSAQSWVY0ynFg3hDGGHQEBAQ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 In-Reply-To: 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:99397 Op 24-11-15 om 22:14 schreef BartC: > On 24/11/2015 20:54, Antoon Pardon wrote: >> Op 24-11-15 om 20:15 schreef Ian Kelly: >> >>>> But no matter what you want to call it. The dis module shows that >>>> -42 is treated in exactly the same way as 42, which is treated >>>> exactly the same way as () or as (5, 8, 13) which is treated >>>> differently from [] or [5, 8, 13]. >>> >>> This is an implementation detail. The compiler would also be free to >>> compile -42 into byte code as the negation of the constant 42. That 42 >>> is a literal, on the other hand, is part of the language >>> specification. >> >> I think you are picking nits. Sure the byte code could compile -42 into >> a byte code for 42 and a negation. Just as it could compile 42 into byte >> code for adding 32, 8 and 2. >> >> The point is, that the reverse isn't true. It couldn't compile [5, 8, 13] >> into a LOAD_CONST. > > I think it can, with a couple of extra instructions: Sure it can with a couple of extra instructions. With extra instructions you can always use constants to build a mutable. The point is that a tuple can just be loaded as a constant without needing something extra. -- Antoon.