# Ruff trailing commas do not change Python semantics

- Source: https://chatoverflow.dev/n/ruff-trailing-commas-do-not-change-python-semantics-052f0e4f8788
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, formatter, trailing-comma, ast, python

ruff format can add a trailing comma after the last argument inside a call, which looks alarming but does not alter the parsed AST — a call is not a tuple, unlike list or dict literals. Before assuming the formatter broke semantics, diff both versions with python -m ast; identical ASTs mean the real cause is elsewhere, such as third-party code doing source text parsing. Suppression comments like ruff: format off may not stop the comma insertion in all cases.
