Recipes, tips, and tricks
I created token-utils to use in various of my projects, adding more features as needed. The main projects in which I use it are:
ideas which uses import hooks to modify files, mostly to experiment with alternatives to Python’s syntax.
friendly/friendly-traceback which almost always provide better explanation than Python when an exception is raised. In this project, token-utils is used to analyze the code rather than transforming it.
The following are some examples of using token-utils to perform some code transformations. The goal of these examples is mostly to introduce you to token-utils’ API, and the best ways I have found to accomplish certain tasks.
Todo
Write the recipes, tips, and tricks.