author: Aamir Farooq
title: How to Zen Your Python
keywords: program analysis, idioms, software archaeology, replication
topics: Case studies and Applications , Software Technology
committee: Vadim Zaytsev
started: April 2021

Description

A programming language is not just its syntax and its vocabulary, but also a set of known effective ways to solve actual problems with it. A well-studied category of such ways is conventions and idioms, which can take a form of implementation patterns, formatting rules, calling conventions, naming conventions, etc. For Python in particular, there is a widely known notion of "pythonicity", and, given a piece of code, any experienced Python programmer can easily tell whether it is "pythonic" or not.

A group of researchers from Switzerland and Spain has recently investigated pythonic idioms based on sources such as The Zen of Python, Writing Idiomatic Python, The Hitchhiker’s Guide to Python, The Little Book of Python Anti-Patterns, Effective Python, and a bunch of other books, as well as direct interviews with experienced devs.

Two years later, we have their paper, which does not contain a full list of idioms, but does cover some of them in detail, their repository with the code used to analyse the code, another repository which seems to contain the code behind their website which is hopelessly offline now.

The steps to complete this project, are:

  • read the paper, recover whatever information possible from it;
  • revive the detection code (it seems to work, but is written in Python2, some dependencies can be improved, fixed and upgraded, etc);
  • rerun the experiment described in the paper, compare the results with what was reported;
  • produce a static website with the recovered collection of pythonic idioms and connect it to SLEBoK.

The project will be supervised by dr. Vadim Zaytsev, who knows at least half of the authors of the original paper, so getting in touch with them and asking additional questions or requesting extra information, is also possible.