[Python-ideas] Objectively Quantifying Readability

Greg Ewing greg.ewing at canterbury.ac.nz
Wed May 2 05:00:46 EDT 2018


Tim Peters wrote:
> def objective_readability_score(text):
>     "Return the readability of `text`, a float in 0.0 .. 1.0"
>     return 2.0 * text.count(":=") / len(text)

A useful-looking piece of code, but it could be more readable.
It only gives itself a readability score of 0.0136986301369863.

-- 
Greg


More information about the Python-ideas mailing list