Automated Refactoring of Non-Idiomatic Python Code: A Differentiated Replication with LLMs
Alessandro Midolo, Massimiliano Di Penta · 2025
Read Automated Refactoring of Non-Idiomatic Python Code: A Differentiated Replication with LLMs by Alessandro Midolo, Massimiliano Di Penta (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2501-17024.txt.
Description
Alessandro Midolo and Massimiliano Di Penta test whether a large language model can clean up Python code in the idiomatic style of the language. Python favors certain expressive constructs, and tools based on static code analysis already exist to rewrite clumsy code into those forms. The authors reran a published study design with GPT-4 in the tool's place, asking it to spot and suggest such rewrites.
The model not only found the idiomatic chances well, it often beat the benchmark tool, proposing fixes where the older method had failed. A hand check of a random sample confirmed the suggestions were correct. The authors say the result shows language models can handle a task that used to need complex hand-built code analyzers. They frame the study as a differentiated replication: same questions as the original work, new engine under the hood, and a careful audit of what changed.
Catalog record
| CREATOR | Alessandro Midolo, Massimiliano Di Penta |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 54 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2501-17024