Extreme Programming is a discipline of software development based on values of simplicity, communication, feedback, and courage. It works by bringing the whole team together in the presence of simple practices, with enough feedback to enable the team to see where they are and to tune the practices to their unique situation.
Let's see how Python fares in light of the 4 core XP values: simplicity, communication, feedback and courage.
1. Python fosters simplicity
- Clean and simple syntax reads like pseudo-code
- Built-in high level data types (strings, lists, tuples, dictionaries) make it possible to pack a lot of functionality in very few lines of code, without sacrificing readability
- As an exercise, try to port Java code to Jython: you will see a significant reduction in line count (as much as 40% in my experience)
- Powerful yet simple idioms enable developers to clearly communicate their intentions through code
- Python just lets you code and doesn't get in your way -- see ESR's classic "Why Python?" article
- Standard coding style enforced by significant whitespace enables people to better read code, maintain it, and communicate about it
- Modules such as doctest provide "executable documentation"
- Dynamic, interpreted nature of the language shortens development cycle and closes feedback loop more quickly
- Interactive shell session provides instantaneous feedback
- Various unit test frameworks (unittest, doctest, py.test) are available for feedback via frequent unit testing
- This really stems from the other 3 values: if you can write code that is simple, provides quick feedback and can be easily understood by your peers, then you have the courage to "go confidently in the direction of your dreams", to quote Thoreau
- Courage in the XP sense also means having the guts to throw away code that doesn't work and start afresh; since the simple act of coding in Python produces pure pleasure, it follows that throwing code away and starting to code anew will be felt not as a chore, but as a chance to improve and, why not, attain enlightenment