Commonly-used names in the Python standard library
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:
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.