Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: BartC Newsgroups: comp.lang.python Subject: Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?) Date: Sat, 12 Mar 2016 23:57:31 +0000 Organization: A noiseless patient Spider Lines: 25 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 Injection-Date: Sat, 12 Mar 2016 23:54:36 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="cf45b3961a050227b1103bebc3cbc15a"; logging-data="6591"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dHHiJeT4CHyZW9rwN8U5B" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: <8737rvxs89.fsf@elektro.pacujo.net> Cancel-Lock: sha1:qo0YhBrEgj1UE/LNg/xfUilDNtI= Xref: csiph.com comp.lang.python:104733 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). -- Bartc