top of page
Search
dmitriyprokhorov87

Writing Idiomatic Python: A PDF Book on Python Style and Conventions



The content of this book looks primarily at the various means for code organization in Python and provides user with a rigorous grounding in these. it dives into topics such as python object system, functions, decorators, metaprogramming and generators providing the reader with an in-depth knowledge of these topics that is essential for writing idiomatic and robust python code. It aims to provide a reader with not only a how-to but also a why for Python concepts. Concepts are well explained with abundance of code snippets.


One of the special concepts in Python is the idea of writing idiomatic code that is most aligned with the language features and ideals. In Python, we call this idiomatic code Pythonic. When you write Pythonic code, you are leveraging over 25 years of experience of many thousands of developers. You are writing code that is expected and tune in the CPython runtime. Most importantly perhaps, you are writing code that is easily read and understood by your fellow and senior Python developers.




writing idiomatic python download pdf



Thanks for your great introduce about Python.I am a developer and also love python. I have been using Python on AI and Data Science tasks. Your introduction guide is excellent. Hope you continue writing great articles. Thanks


A Byte of Python by Swaroop CH - This is a free book on python available online. A PDF copy is also available for download. It is a gentle introduction to python and quickly introduces you to the python ecosystem and fundamentals. It doesn't cover much about programming in general, but as a first introduction to the python language, I recommend this book. The book is around 100 pages and doesn't go into advanced features of python. The book covers installing and getting started, basics, operators, control flow, functions, modules, basic data structures, basics of object oriented programming/problem solving, input/output, exceptions and standard library. This book is available as an open source project here.


Once you have completed these beginner books and has practical experience working with python projects, you may want to learn a bit more about pythonic way of writing code. Following are my recommendations for intermediate to advanced python programmers,


Effective Python by Bret Slatkin - Effective python is a mandatory reading for anyone who uses python in a professional setting or uses it frequently. It consists of 90 important things you need to know when writing python programming in python language organized in 10 chapters. Based on the style of classic effective c++ by Scott Meyers, this is a must have book for any programmer's library. Each advice consists of a brief background followed by plenty of code examples illustrating how the advice is to be applied when writing python code. Reading this book makes you understand how expert programmers write python code. Some examples from the 90 items included in the book are - Prefer raising exceptions to returning None (item 20), Profile before optimizing (item 70) and Consider interactive debugging with pdb (item 80).


Fluent Python by Luciano Ramalho - Fluent python is an advanced book on python that will enable you to understand and write effective and idiomatic python code. As the author himself says in preface, this book was written for practicing Python programmers who want to become proficient in Python 3. With over 700 pages, this book covers python data model, data structures, object oriented idioms, advanced control flows such as generators and coroutines and meta programming. It covers almost all advanced python features an experienced programmer is expected to know such as design patterns, function decorators and closures, ABC, inheritance, operator overloading, context managers, concurrency, class metaprogramming etc.


Python Cookbook by David Beazley and Brian K Jones - David Beazley is a well known software engineer who has made substantial contributions to the python developer community. His video sessions and keynotes are available on youtube and they are notable for the in-depth look at python and its ecosystem. Python cookbook is intended for experienced python programmers looking to deepen their understanding of the language and advanced programming techniques and idioms in python. This book organizes python recipes/techniques under 15 different chapters covering areas from data structures/algorithms, data types(string,numbers, dates etc.), modules, metaprogramming, network programming, c extensions etc. Each recipe is organized in 3 sections - problem, solution and discussion. Some example recipes are sanitizing and cleaning up text, reading and writing binary data and replacing single method classes with functions.


2ff7e9595c


0 comments

Recent Posts

See All

Comments


bottom of page