Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Mark Lawrence Newsgroups: comp.lang.python Subject: Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?) Date: Sun, 13 Mar 2016 01:10:40 +0000 Lines: 36 Message-ID: References: <56e44258$0$1598$c3e8da3$5496439d@news.astraweb.com> <8737rvxs89.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 6aVGaSyu6sYs5a4hT8GoOwIMBeRSiYzBxyQSHFD4j2Ig== 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; 'from:addr:yahoo.co.uk': 0.05; 'defines': 0.07; 'plenty': 0.07; 'assigning': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runtime': 0.09; 'subject:which': 0.09; 'vast': 0.09; 'python': 0.10; 'python.': 0.11; 'languages,': 0.15; 'variables': 0.15; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'recipes': 0.16; 'subject:?)': 0.16; 'them.)': 0.16; 'wrote:': 0.16; 'programmer': 0.18; 'language': 0.19; '>>>': 0.20; 'bonus': 0.20; 'java': 0.22; 'assign': 0.22; 'lawrence': 0.22; 'programming': 0.22; 'leave': 0.23; 'sets': 0.23; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'chris': 0.26; 'switch': 0.27; '2000.': 0.29; 'cases.': 0.29; 'them?': 0.29; "i'm": 0.30; 'code': 0.30; 'language.': 0.32; 'run': 0.33; "i'll": 0.33; 'happened': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'project': 0.36; 'there': 0.36; 'possible.': 0.36; '(and': 0.36; 'keyword': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'agree': 0.37; 'received:org': 0.37; 'hundreds': 0.37; 'someone': 0.38; 'mean': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'subject:The': 0.61; 'charset:windows-1252': 0.62; 'more': 0.63; 'our': 0.64; 'afraid': 0.67; 'risk': 0.68; 'expert': 0.70; 'faster.': 0.84; 'houses.': 0.84; 'pythonistas,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 80.234.129.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 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:104734 On 12/03/2016 23:57, BartC wrote: > On 12/03/2016 22:10, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> I completely agree with you that the keyword should mean "write-once" >>> or "never rebind". >> >> That would be possible. I'm afraid that would result in people >> sprinkling these "constant" keywords everywhere to make the program >> supposedly run faster. -- Something like that has happened with the >> "final" keyword in some Java houses. > > I use 'const' everywhere in other languages, most often in the form of > sophisticated sets of enums. A single project might have 1000 or even > 2000. (Example that defines a set of byte-codes: > http://pastebin.com/q1UwjKmK) > > How does Python manage without them? Is it really necessary to declare > hundreds of individual variables and assign a value to each? (And risk > someone assigning a new value to them.) > > That they might lead to more efficient code is secondary, but definitely > a bonus (essential though when used in a switch statement). > It is 2016. Programmer time, and hence money, are far more important than runtime speed in the vast majority of cases. There are plenty of working recipes for switch in Python. I'll leave you to quote a few as you are such an expert in the Python programming language. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence