Commonly-used names in the Python standard library

Chris Angelico rosuav at gmail.com
Fri Feb 21 08:02:53 CET 2014


On Fri, Feb 21, 2014 at 5:51 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> 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



More information about the Python-list mailing list