Flatliner: turn python programs into one line of (still python) code

This page summarizes the projects mentioned and recommended in the original post on /r/Python

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • flatliner-src

    Convert python3 programs into one line of python code!

  • Very briefly, it first parses the input code into an AST, then it converts the last node into a single line, and continuously "wraps" remaining nodes around this line mainly using lambdas until everything becomes one line. The source code is available for anyone who is interested in the nitty-gritty :)

  • onelinerizer

    Shamelessly convert any Python 2 script into a terrible single line of code

  • Very cool. Also, Chelsea Voss did this in 2016 with Python 2 (https://github.com/csvoss/onelinerizer) and did a great talk about it at PyCon (https://www.youtube.com/watch?v=DsUxuz_Rt8g) . She also has try/except working, maybe something similar to her solution would also work in Python 3.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts