Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:134': 0.05; 'tom': 0.07; 'variables': 0.07; 'classes.': 0.09; 'methods,': 0.09; 'subject:design': 0.09; 'type,': 0.09; 'python': 0.11; 'wrote': 0.14; 'dynamic,': 0.16; 'gotcha.': 0.16; 'mutable': 0.16; 'new-style': 0.16; 'semantics': 0.16; 'sins': 0.16; 'subject:Language': 0.16; 'rules': 0.22; 'header:User-Agent:1': 0.23; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'resolution': 0.29; "d'aprano": 0.31; 'operators': 0.31; 'steven': 0.31; 'regular': 0.32; 'except': 0.35; 'but': 0.35; 'there': 0.35; 'combination': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'anything': 0.39; 'bad': 0.39; 'to:addr:python.org': 0.39; 'negative': 0.60; 'ago,': 0.61; 'course': 0.61; 'here': 0.66; 'optimized': 0.68; 'reverse': 0.68; 'default': 0.69; 'hardly': 0.84; 'mistakes,': 0.84; 'pardon': 0.84; 'started,': 0.84; 'thing,': 0.91 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8EAOTPLlKGuA9G/2dsb2JhbABbgz/DAoE8gxoBBXgRCyEWDwkDAgECAUUTCAKHfgy4SohYj2IWhAcDl3aGG4tQgyI Date: Tue, 10 Sep 2013 09:58:22 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Language design References: <522eb795$0$29999$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <522eb795$0$29999$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378799904 news.xs4all.nl 15980 [2001:888:2000:d::a6]:48303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53910 Op 10-09-13 08:09, Steven D'Aprano schreef: > Some time ago, Tom Christiansen wrote about the "Seven Deadly Sins of > Perl": > > http://www.perl.com/doc/FMTEYEWTK/versus/perl.html > > > What design mistakes, traps or gotchas do you think Python has? Gotchas > are not necessarily a bad thing, there may be good reasons for it, but > they're surprising. > > To get started, here are a couple of mine: > > > - Python is so dynamic, that there is hardly anything at all that can be > optimized at compile time. > > - The behaviour of mutable default variables is a gotcha. > > - Operators that call dunder methods like __add__ don't use the same > method resolution rules as regular methods, they bypass the instance and > go straight to the type, at least for new-style classes. Slice semantics in combination with negative indices. Take ls = range[10] What is the reverse of ls[a : b]? It is [b-1 : a-1: -1] Except of course when a == 0 or b == 0. -- Antoon Pardon