Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; '21,': 0.07; 'pep': 0.09; 'url:github': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ancillary': 0.16; 'ast': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'keyword,': 0.16; 'research:': 0.16; 'simple.': 0.16; 'sorts': 0.16; 'subject:library': 0.16; 'url:py': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'basically': 0.19; 'thu,': 0.19; 'examples': 0.20; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "d'aprano": 0.31; 'extensively': 0.31; 'steven': 0.31; 'file': 0.32; 'stuff': 0.32; 'fri,': 0.33; 'subject:the': 0.34; 'received:google.com': 0.35; 'module.': 0.36; 'done': 0.36; 'doing': 0.36; 'needed': 0.38; 'pm,': 0.38; 'how': 0.40; 'easy': 0.60; 'analyze': 0.60; 'new': 0.61; 'week,': 0.64; 'love': 0.65; 'actually,': 0.84; 'url:master': 0.84; 'to:none': 0.92 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=WwyJ5N/V4jm+s/mA4NlTFk6YGMl6kdoitKnp7aBmd3M=; b=H7BtMFte0178f6D7QEZXnpipBhz85baSB7opYQfEfJ4OUiQ6Q7c1sPGvQOIF3TZPk6 vlH6qyMs/Up/vyhHLiVXa4gCmLQ/XJbiK5vbpwjbvrOaKueXEN4TDIs6w0JnIe3i9D0Z 9BzBP1zEbFi3aw09RRYKuuaou+yIQz4T5s1QXxOpokYsKg42nKPg42V/yqDvLyZkgyV3 iT0G8Z8mD15/Tzy4OOsihvdSpvKCFpwWDcdxpmunFoDUZixjrfwMavcQYwrYg2U+23y7 AI8TpcDhgD8cwIcz/2jIZ8nKHg+xXjoWVtiGim4YK93WojVrmxHhApiM9JbbbDQha+/v fZNA== MIME-Version: 1.0 X-Received: by 10.68.201.10 with SMTP id jw10mr7314408pbc.25.1392966177534; Thu, 20 Feb 2014 23:02:57 -0800 (PST) In-Reply-To: <5306f769$0$29985$c3e8da3$5496439d@news.astraweb.com> References: <5306f769$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 21 Feb 2014 18:02:53 +1100 Subject: Re: Commonly-used names in the Python standard library 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392966187 news.xs4all.nl 2871 [2001:888:2000:d::a6]:36626 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66801 On Fri, Feb 21, 2014 at 5:51 PM, Steven D'Aprano wrote: > On Thu, 20 Feb 2014 20:39:10 +1100, Chris Angelico wrote: > >> In working on a proposal that might result in the creation of a new >> keyword, I needed to ascertain what names were used extensively in >> existing Python code. > > I would love to steal^W see your script for doing this :-) No probs! It's part of my ancillary stuff for the PEP 463 research: https://github.com/Rosuav/ExceptExpr/blob/master/find_except_expr.py It basically just runs over one file at a time, parses it into an AST, and walks the tree. Pretty simple. Actually, some of these sorts of things might make neat examples of what can be done with the ast module. Until this week, I had no idea how easy it was to analyze Python code this way. ChrisA