Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: OT: This Swift thing Date: Fri, 06 Jun 2014 00:53:44 +0300 Organization: A noiseless patient Spider Lines: 59 Message-ID: <87y4xbt447.fsf@elektro.pacujo.net> References: <8738fjkc2w.fsf@dpt-info.u-strasbg.fr> <87tx7zi0i1.fsf@dpt-info.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="8159"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+437mg2yDianOrYrvv0V2S" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:TThw8T+f1TY5fM50kjHfnJ/4Kns= sha1:j3ZeAOs/HCLZ+voeOVS0sUMO6Jw= Xref: csiph.com comp.lang.python:72771 Mark Lawrence : > On 05/06/2014 21:07, Alain Ketterlin wrote: >> Sturla Molden writes: >>> On 05/06/14 10:14, Alain Ketterlin wrote: >>>> Type safety. >>> Perhaps. Python has strong type safety. >> Come on. > > I don't understand that comment, please explain. I guess what is referred to is static typing. It serves two purposes: 1. It makes the managers of software development teams believe the junior developers in their teams won't be able to do too much damage as the compiler at least enforces some rigor in the code. Hence, "safety." 2. It makes it much easier to automatically optimize the code. Unfortunately, it also has serious downsides: 3. The code becomes very tedious to type in. You may need hundreds of lines of boilerplate code before it actually does anything. It also easily makes you lose your focus. 4. The flow of the code becomes hard to understand because of the boilerplate. Ironically, the very straitjacket that seeks to force good quality on you prevents you from seeing the forest for the trees. Example: Map makeStreetAddressMap( List infoList) { Map map = new HashMap(); for (StreetInfo info : infoList) map.put(info.getStreetAddress(), info.getZipCode()); return map; } vs def make_street_address_map(info_list): map = {} for info in info_list: map[info.get_street_address()] = info.get_zip_code() return map or: def make_street_address_map(info_list): return dict((info.get_street_address(), info.get_zip_code()) for info in info_list) Marko