Clone wiki

CherryPy / ZenOfCherryPy

Obviously, the Zen of Python still applies.

The Zen of CherryPy

1. Common tasks should be fast and easy.

  • Ikkyu asked Subhuti, "how do I turn on gzip?" Subhuti answered, "tools.gzip.on".

2. Doing nothing should be easier and faster.

  • Ikkyu asked Subhuti, "how do I turn off sessions?" Subhuti answered, "".

3. Extensions to CherryPy should look like CherryPy.

  • Ikkyu asked Subhuti, "how do I turn on Subhuti?" Subhuti answered, "tools.subhuti.on". From that day on, Ikkyu asked Subhuti no more questions.

4. Objects are better than referents.

  • Joshu asked, "may I please have a server?" His master replied, "server".

5. Domain-specific Python is better than new DSL's.

  • The master asked Kakua, "what is CherryPy?" Kakua answered, "CherryPy is a wrapper for HTTP, XML, HTML, REST, AJAX, CSS, JS, RSS and JSON." The master replied, "you are gravely mistaken. CherryPy is an object, with attributes and methods."

6. But imperative Python is better yet.

  • The master asked Kakua again, "what is CherryPy?" Kakua answered, "CherryPy is an object, with attributes and methods." Angrily, the master answered, "no! CherryPy is a function, with inputs and outputs."

7. Unless that isn't enough.

  • The master asked Kakua a third time, "what is CherryPy?" Kakua answered, "CherryPy is a function and an object." The master answered, "CherryPy is not made for CherryPy, but it is made from CherryPy." At that moment, Kakua was enlightened.

8. Subclassed builtins are better than custom types.

  • Gasan told his followers, "request headers should be a mapping of unique names to multiple values, with methods for inspecting and manipulating each collection singly or in groups." One of his acolytes murmured, "a dict does most of that." Gasan shouted, "Excellent! You are not far from CherryPy-nature."

9. But builtin types are even better.

  • {}

10. 1 < 2, but 0 > 1

  • A student boasted to Hakuin, "each application I write has a better templating engine than the previous one." Hakuin said, "Good! I need you to write an application for me." The student, who was very experienced, asked, "aha, and what will you be producing, HTML or XML?" Hakuin replied, "yes."