Writing Idiomatic Python 2
The "Writing Idiomatic Python" book is finally here! Chock full of code samples, you'll learn the "Pythonic" way to accomplish common tasks. Each idiom comes with a detailed description, example code showing the "wrong" way to do it, and code for the idiomatic, "Pythonic" alternative.<br /><br />*This version of the book is for Python 2.7+. There is also a Python 3 version available.*<br /><br />"Writing Idiomatic Python" contains the most common and important Python idioms in a format that maximizes identification and understanding. Each idiom is presented as a recommendation to write some commonly used piece of code. It is followed by an explanation of why the idiom is important. It also contains two code samples: the "Harmful" way to write it and the "Idiomatic" way.<br /><br />* The "Harmful" way helps you identify the idiom in your own code.<br />* The "Idiomatic" way shows you how to easily translate that code into idiomatic Python.<br /><br />This book is perfect for you:<br /><br />* If you're coming to Python from another programming language<br />* If you're learning Python as a first programming language<br />* If you're looking to increase the readability, maintainability, and correctness of your Python code<br /><br />What is "Idiomatic" Python?<br /><br />Every programming language has its own idioms. Programming language idioms are nothing more than the generally accepted way of writing a certain piece of code.<br /><br />Consistently writing idiomatic code has a number of important benefits:<br /><br />* Others can read and understand your code easily<br />* Others can maintain and enhance your code with minimal effort<br />* Your code will contain fewer bugs<br />* Your code will teach others to write correct code without any effort on your part