The Zen of Python

Sparse is better than dense.
Readability counts.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.

As the Zen of Python, Python is meant to be readable and easy to understand, but many of the Python code golf answers are not this. They do not follow best practices like spaces around operators and stuff like that. I'm not complaining but I want to know what everyone thinks:

Is Code Golf ruining the point of Python?

  • 9
    \$\begingroup\$ You’d be absolutely correct to say that well-golfed code is often the antithesis to good code. We’re aware of this, and aren’t trying to claim otherwise. \$\endgroup\$
    – Bbrk24
    Commented Jun 9, 2023 at 0:31
  • 3
    \$\begingroup\$ this is like someone complaining that frisbee golf is ruining the sanctity of frisbee and/or golf \$\endgroup\$
    – Jo King Mod
    Commented Jun 9, 2023 at 1:39
  • 3
    \$\begingroup\$ In short: code golf, on this site, is more important than the Zen of Python. \$\endgroup\$ Commented Jun 9, 2023 at 3:13

2 Answers 2


The whole point of Code Golf is for code to be short. That means Unnecessary™ stuff like "spaces around operators" is omitted. You are correct, golfed code is often horribly unreadable, but that's that whole point of the game. If you are looking for code snippets to use in your program, this is not the place (ok, maybe except APL). Nobody golfs code in production anymore, so there's no harm coming to Python.

  • 3
    \$\begingroup\$ No, code golf is only part of my work to attract people to APL. We don't golf production APL — it is already plenty concise. Historically, people did golf production code — to make it fit in the available computer memory. \$\endgroup\$
    – Adám
    Commented Jun 9, 2023 at 6:09
  • 2
    \$\begingroup\$ Some people still manually mimify their Javascript to make it faster to download \$\endgroup\$
    – mousetail
    Commented Jun 13, 2023 at 5:53

We don't care about programming conventions.

We only care about how short the code is.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .