Better Python Code: A Guide for Aspiring Experts
Author: David Mertz (Author)
Publisher finelybook 出版社: Addison-Wesley Professional
Edition 版次: 1st
Publication Date 出版日期: 2023-11-24
Language 语言: English
Print Length 页数: 288 pages
ISBN-10: 0138320942
ISBN-13: 9780138320942
Book Description
Move Beyond Python Code That “Mostly Works” to Code That Is Expressive, Robust, and Efficient
Python is arguably the most-used programming language in the world, with applications from primary school education to workaday web development, to the most advanced scientific research institutes. While there are many ways to perform a task in Python, some are wrong, inelegant, or inefficient. Better Python Code is a guide to “Pythonic” programming, a collection of best practices, ways of working, and nuances that are easy to miss, especially when ingrained habits are borrowed from other programming languages.
Author David Mertz presents concrete and concise examples of various misunderstandings, pitfalls, and bad habits in action. He explains why some practices are better than others, based on his 25+ years of experience as an acclaimed contributor to the Python community. Each chapter thoroughly covers related clusters of concepts, with chapters sequenced in ascending order of sophistication.
Whether you are starting out with Python or are an experienced developer pushing through the limitations of your Python code, this book is for all who aspire to be more Pythonic when writing better Python code.
- Use the right kind of loops in Python
- Learn the ins and outs of mutable and immutable objects
- Get expert advice to avoid Python “gotchas”
- Examine advanced Python topics
- Navigate the “attractive nuisances” that exist in Python
- Learn the most useful data structures in Python and how to avoid misusing them
- Avoid security mistakes
- Understand the basics of numeric computation, including floating point numbers and numeric datatypes
“My high expectations for this engaging Python book have been exceeded: it offers a great deal of insight for intermediate or advanced programmers to improve their Python skills, includes copious sharing of precious experience practicing and teaching the language, yet remains concise, easy to read, and conversational.”
–From the Foreword by Alex Martelli
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Review
“You’ll not just be aspiring to be an expert anymore after practicing through Better Python Code: A Guide for Aspiring Experts, you’ll be one of them! Learn from David Mertz, who’s been making experts through his writing and training for the past 20 years.”
–Iqbal Abdullah, past Chair, PyCon Asia Pacific, and past board member, PyCon Japan
“In Better Python Code: A Guide for Aspiring Experts, David Mertz serves up bite-sized chapters of Pythonic wisdom in this must-have addition to any serious Python programmer’s collection. This book helps bridge the gap from beginner to advanced Python user, but even the most seasoned Python programmer can up their game with Mertz’s insight into the ins and outs of Python.”
–Katrina Riehl, President, NumFOCUS
“What separates ordinary coders from Python experts? It’s more than just knowing best practices–it’s understanding the benefits and pitfalls of the many aspects of Python, and knowing when and why to choose one approach over another. In this book David draws on his more than 20 years of involvement in the Python ecosystem and his experience as a Python author to make sure that the readers understand both what to do and why in a wide variety of scenarios.”
–Naomi Ceder, past Chair, Python Software Foundation
“Like a Pythonic BBC, David Mertz has been informing, entertaining, and educating the Python world for over a quarter of a century, and he continues to do so here in his own pleasantly readable style.”
–Steve Holden, past Chair, Python Software Foundation
“Being expert means someone with a lot of experience. David’s latest book provides some important but common problems that folks generally learn only after spending years of doing and fixing. I think this book will provide a much quicker way to gather those important bits and help many folks across the world to become better.”
–Kushal Das, CPython Core Developer and Director, Python Software Foundation
“This book is for everyone: from beginners, who want to avoid hard-to-find bugs, all the way to experts looking to write more efficient code. David Mertz has compiled a great set of useful idioms that will make your life as a programmer easier and your users happier.”
–Marc-André Lemburg, past Chair, EuroPython, and past Director, Python Software Foundation
About the Author
David Mertz has been a member of the Python community for 25 years. He has taught Python to scientists, developers coming from other languages, and to programming neophytes. He was a director of the Python Software Foundation (PSF) for six years and continues to serve on, or chair, a variety of PSF working groups. David is the author of several technical books and has given keynote addresses at numerous international programming conferences.