Skip to content

A demo if __name__ == "__main__": block in a module other code imports; an examples or demo folder nobody asked for ​

Code nobody needs: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as demo-code and new-folder.

What makes a demo __main__ block or demo folder nobody asked for a bad practice? ​

The standard that calls it a bad practice: YAGNI.

What does lessloc do about a demo __main__ block or demo folder nobody asked for? ​

lessloc catches it as demo-code and new-folder.

  • demo-code (tier 2): An example or demo block, such as if __name__ == "__main__":, in a module other code imports.
  • new-folder (tier 2): A new folder with one or two entries, or an examples or demo folder nobody asked for.

The other patterns in Code nobody needs:

Released under the Apache-2.0 license. · llms.txt