Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'heavily': 0.04; 'languages,': 0.04; '(so': 0.07; 'args': 0.07; 'definitions': 0.07; 'string': 0.09; 'consistency': 0.09; 'http': 0.09; 'latter': 0.09; 'subject:number': 0.09; 'trailing': 0.09; 'url:blog': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'language,': 0.12; 'clear.': 0.16; 'comma': 0.16; 'consistency.': 0.16; 'definitions,': 0.16; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'importance:': 0.16; 'iterable': 0.16; 'letters.': 0.16; 'lowercase': 0.16; 'naming,': 0.16; 'tab': 0.16; 'unchanged': 0.16; 'variations': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; "python's": 0.19; 'examples': 0.20; 'code,': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'library,': 0.24; 'pointer': 0.24; 'precise': 0.24; 'unicode': 0.24; 'fairly': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'nearly': 0.26; 'second': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; '[1]': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'languages': 0.32; 'worked': 0.33; 'subject:the': 0.34; "i'd": 0.34; 'equal': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'consistent': 0.36; 'doing': 0.36; 'two': 0.37; 'clear': 0.37; 'being': 0.38; 'pm,': 0.38; 'little': 0.38; 'expect': 0.39; 'though,': 0.39; 'url:2012': 0.39; 'how': 0.40; 'even': 0.60; 'browser': 0.61; "you're": 0.61; 'back': 0.62; "you'll": 0.62; "you've": 0.63; 'places': 0.64; 'more': 0.64; 'within': 0.65; 'here': 0.66; 'biggest': 0.67; 'containing': 0.69; 'fact,': 0.69; 'expectations': 0.74; 'subject:get': 0.81; 'everything.': 0.84; 'pike': 0.84; 'thing).': 0.84; 'to:none': 0.92; 'factors': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=3cQRr0UG2M72HQ1oW9axVMSkrE86U7rULiw1k8ZrLxs=; b=bBhgpfEtGfBltpBx2/qGkIP7sDSVISrzFVVHnMwkqTsR28yxCZcH7WCW0WOsYK1JQG K3WmQqd0RmX21P+sOb4jCIvWWKBBD93DQYoEiY4gQnwAEcL+Q2i4nb9dHM/xAsZ/7Omk dS8pxJMgejMdC2V3QwlPb2uj1gfUpxj2xGWMIOhriIBlnS8A/NbzuWICNsgNOKuTg6WT tc+b+2N/omNQZD1b+QhfkZBRDYBPsiuCnTSLI/71mBSu/NP7Zmn7ef12osuDCYPZK0F9 9hZ7Nua+xyagR0DI6QPkotwU81aXvexhbUge0SEAjsD3veHN+wnBDTLLQSkszLy0003U UKrA== MIME-Version: 1.0 X-Received: by 10.50.80.76 with SMTP id p12mr28746231igx.34.1407755196739; Mon, 11 Aug 2014 04:06:36 -0700 (PDT) In-Reply-To: <87d2c7wbgq.fsf@elektro.pacujo.net> References: <53E658CD.5020904@gmail.com> <53e59035$0$29998$c3e8da3$5496439d@news.astraweb.com> <338e8fb0-c9ec-462a-b560-1c1ff77de17e@googlegroups.com> <154cc342-7f85-4d16-b636-a1a953913c98@googlegroups.com> <8c41d779-0c26-430a-a915-08c2b962e0e7@googlegroups.com> <87ha1jweq7.fsf@elektro.pacujo.net> <87d2c7wbgq.fsf@elektro.pacujo.net> Date: Mon, 11 Aug 2014 21:06:36 +1000 Subject: Re: how to get the ordinal number in list From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407755204 news.xs4all.nl 2970 [2001:888:2000:d::a6]:52204 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76046 On Mon, Aug 11, 2014 at 8:46 PM, Marko Rauhamaa wrote: > The main thing is that the definitions must be clear. I must be able to > look up the precise description quickly, and in fact, I always have the > Python Library Reference in a browser tab or two because I have to > review even familiar functionality over and over again. Less often, I > also have to review the Python Language Reference. > > You don't have to like the = sign or the trailing comma of 1-tuples. > What matters is that you know how to use them. Fair enough. I'd say that there are two "main things", of nearly equal importance: one is clear definitions, as you describe, and the other is memorable definitions (so you don't have to keep going back to the reference for every little thing). The consistency you describe as your second priority is really part of memorability, because you can learn one principle and have it work for everything. Contrast the PHP standard library, where there's very little consistency in naming, so you're constantly going back to the docs - see examples here [1] - I can fully understand that switching from language to language will have me doing this sort of thing (often with very good justification - map() in Python takes func,iter,... but map() in Pike takes iter,func,...; this is because Python's map() takes multiple iterables, while Pike's takes exactly one iterable and will pass any other args through to the function unchanged - which is consistent with a lot of other Pike callback-calling functions), but within a single language, it's more reasonable to expect consistency. There are innumerable facets to the memorability of definitions, though, and consistency's just one of them. The ELIZA effect factors heavily in memorability; if you see "a + b" in code, you'll expect it to be, in some way, adding a and b. If you know what HTTP means from other places on the internet, you'll have some fairly strong expectations about the functionality of BasicHTTPServer. If you've worked with any of a huge bunch of languages, you'll not at all be surprised that "asdf" is a string containing those four letters. And that latter is true even though lots of languages have their variations - biggest one being that Python 3's "asdf" is a string of four Unicode codepoints, while C's "asdf" is a pointer to a buffer of four bytes (plus the 0, so five really); it's still a string containing four lowercase letters. And that's a Good Thing. ChrisA [1] http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/#standard-library