Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Al Sweigart

Rating No ratings yet

BRIDGE THE GAP BETWEEN NOVICE AND PROFESSIONAL You’ve completed a basic Python programming tutorial or finished Al Sweigart’s best selling Automate the Boring Stuff with Python. What’s the next step toward becoming a capable, confident software developer? Welcome to Beyond the Basic Stuff with Python. More than a mere collection of advanced syntax and masterful tips for writing clean code, this book will teach you how to advance your Python programming skills by using the command line and other professional tools like code formatters, type checkers, linters, and version control. Sweigart takes you through best practices for setting up your development environment, naming variables, and improving readability, then tackles documentation, organization and performance measurement, as well as object-oriented design and the Big-O algorithm analysis commonly used in coding interviews. The skills you learn will boost your ability to program—not just in Python but in any language. You’ll learn: • Coding style, and how to use Python’s Black auto-formatting tool for cleaner code • Common sources of bugs, and how to detect them with static analyzers • How to structure the files in your code projects with the Cookiecutter template tool • Functional programming techniques like lambda and higher-order functions • How to profile the speed of your code with Python’s built-in timeit and cProfile modules • The computer science behind Big-O algorithm analysis • How to make your comments and docstrings informative, and how often to write them • How to create classes in object-oriented programming, and why they’re used to organize code Toward the end of the book you’ll read a detailed source-code breakdown of two classic command-line games, the Tower of Hanoi (a logic puzzle) and Four-in-a-Row (a two-player tile-dropping game), and a breakdown of how their code follows the book’s best practices. You’ll test your skills by implementing the program yourself. Of course, no single book can m

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical bridge from "I can write Python" to "I can write Python other people want to maintain," covering tooling, style, debugging, profiling, and object-oriented design. Best for self-taught programmers and tutorial graduates who want professional habits without a computer science degree. 【Book Arc】 - **Opening (~0%–15%)**: Frames the novice-to-professional gap and sets expectations for who should read it and how to think about a programming journey. - **Early (~15%–30%)**: Establishes fundamentals of professional practice — reading tracebacks, asking good questions, and working confidently in the command line, filesystem, and environment variables. - **Middle (~30%–55%)**: The core best-practices toolkit: code formatting with Black, naming, code smells, Pythonic idioms, jargon, common gotchas, and effective functions. - **Late (~55%–75%)**: Documentation, type hints, Git-based project organization, and performance measurement with Big-O analysis, plus practice projects to apply the material. - **Ending (~75%–100%)**: Object-oriented Python — classes, inheritance, properties, and dunder methods — closing with a source-code walkthrough of two command-line games. 【Key Takeaways】 - **Professionalism starts with error literacy** (Early): reading tracebacks, searching error messages, and using linters to prevent bugs before they happen. - **The command line is a developer tool, not a relic** (Early): paths, processes, environment variables, and PATH management are prerequisites for running real tooling. - **Formatting is a solved problem — delegate it** (Middle): Black removes style debates; PEP 8 and spacing conventions matter mainly as shared expectations. - **Names carry most of your code's readability** (Middle): casing conventions, appropriate length, searchability, and avoiding built-in shadowing. - **Code smells are heuristics, not laws** (Middle): duplicate code, magic numbers, dead code, and nested comprehensions are warning signs — but the book explicitly debunks myths like "one return per function." - **Pythonic code means using the language's intended idioms** (Middle): enumerate over range, with over open/close, is for None, f-strings, defaultdict, and dictionaries instead of switch. - **Measure before optimizing** (Late): timeit and cProfile plus Big-O reasoning give you evidence rather than intuition about performance. - **OOP is an organizational tool, not a default** (Ending): classes, inheritance, properties, and dunder methods are introduced with the question of when they actually help. 【Reading Tips】 - Skim the environment/command-line chapter if you already live in a terminal; deep-read the code smells and Pythonic code chapters, which are the book's densest practical value. - Treat the two game walkthroughs (Tower of Hanoi, Four-in-a-Row) as exercises — implement before reading the breakdown to get real feedback on your habits. - Keep Black, a linter, and Git open alongside the book; the material is designed to be applied immediately, not just read. - The OOP section rewards readers who have already written messy procedural code — if you haven't, revisit it after a project. 【Coverage Limits】 The excerpts are dominated by front matter and the table of contents, so chapter-level detail beyond titles is thin; specifics of the practice projects and OOP chapters are not covered here.
Excerpt 1
oriented programming, and why they’re used to organize code Toward the end of the book you’ll read a detailed source-code breakdown of two classic command-li...
View in text
Page 10
nted Programming and Inheritance . . . . . . . . . . . . . . . . . . . . . . 293 Chapter 17: Pythonic OOP: Properties and Dunder Methods . . . . . . . . . ....
View in text
Page 12
the Command Line with -c . . . . . . . . . . . . . . . . . . 26 Running Python Programs from the Command Line . . . . . . . . . . . . . . . . . . . . 26 C O...
View in text
Page 13
. 51 A Vertical Spacing Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Vertical Spacing Best Practices . . . . . . . . ....
View in text
Page 15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Type Coercion vs . Type Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Page 16
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 Setting Type Hints for Multiple Types . . . . . . . . . . . . . . . . . . ....
View in text
Page 17
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Creating Objects from Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Page 18
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Reflected Numeric Dunder Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Tags
AI categories
PythonProgrammingSoftware
ISBN: 1593279671
Publisher: No Starch Press
Publish Year: 2021
Language: English
Pages: 321
File Format: PDF
File Size: 7.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…