~/talk

Unlocking Python's AST: The Metaprogramming Superpower You Didn't Know You Had

Talkat PyCon Israel 2024 · on Monday, 2024-09-16· [python, compilers-and-language-design]
slides:none on file

Builds a concrete linter that parses code with Python's ast module, walks nodes with ast.NodeVisitor, and decompiles nodes back to source using astor to detect calls to requests.get missing a timeout. It inspects Call nodes for Attribute funk values, checks .value.id == "requests" and .attr == "get", scans keyword args and treats keyword values of Constant(None) as invalid. Tested on a sample file and flags one invalid call at line 6, column 19.

AI-written summary · about

  1. 0:00The problem definition
  2. 1:19Evaluating potential solutions
  3. 3:39Introduction to ASTs
  4. 7:53Traversing trees with visitors
  5. 11:54Implementing the solution
  6. 16:08Conclusion and resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.