Feels like Neo learning jujitsu in the Matrix.John Beauford (@johnbeauford)
Powerful Python is already helping me get huge optimization gains.Timothy Dobbins (@TmthyDobbins)
Thanks. Keep up the good work. Your chapter on decorators is the best I have seen on that topic.Leon Tietz, Minnesota
It's direct. Goes right for a couple of subjects that have real-world relevance.Chuck Staples, Maine, USA
What have I found good and valuable about the book so far? Everything honestly. The clear explanations, solid code examples have really helped me advance as a Python coder... Thank you for the book and video series! It has really helped me grasp some advanced concepts that I felt were beyond my abilities.Nick S., Colorado, USA
There are PLENTY of books written for programming in Python today. The only problem: almost all are written for those new to programming, new to Python, or both.
That does you no good. In contrast to the sprawling wealth of resources available for learning "hello world" in Python, there's been very little for those of us far past that stage... professionals seeking to elevate our mastery of the language, and our craft.
That's why I wrote Powerful Python: The Most Impactful Patterns, Features, And Development Strategies Modern Python Provides. What's inside:
- An unrelenting selective spotlight on what's most valuable and impactful to working, full-time, professional Python developers
- Well-researched, detailed, realistic code on almost every page, powerfully illustrating key points. Very little "toy code"
- An enthusiastic and unapologetic focus on Python 3, and what makes it great... with full explanation and support for getting the same results with Python 2.7
- Pragmatic advice on package management, development environments, and using Python with version control
- How to use decorators to add rich features to functions and classes; untangle distinct, frustratingly intertwined concerns in your code; and build powerful, extensible software frameworks. (Sincerely, I believe this is the best, most extensive, thorough and valuable rundown of Python decorators ANYWHERE!)
- How to use Python in ways that incentivize other developers to use and re-use your code, again and again... amplifying the impact of the code you write, improving your reputation among your peers, and even helping your career!
- You'll gain a profound and fundamental understanding of how iteration truly works in Python... an understanding that will open your eyes to powerfully and easily weaving iterators and generators throughout your applications, making them massively scalable, highly performant, and more readable and maintainable
- How "magic methods" imbue natural, readable, expressive syntax into your classes and objects... and how to "break the rules" to craft stunningly intuitive, compellingly reusable library interfaces
- Valuable and powerful design patterns, and how Python's special language features give you uniquely powerful implementations not possible in other languages
- A common thread throughout the book, on navigating that intricate balance between using Python in ways that support both your professional and career development... as well as your personal happiness and fulfillment in practicing our delightful and profoundly rewarding craft. Forget choosing one or the other - let's go for both! (This isn't just for Python, by the way.)
- Deep and detailed instruction on how to write practical, realistic unit tests (and other forms of automated tests), and leverage little-known Python features to magnify the value tests bring to your development
- How to use test-driven development to easily get into a state of flow... where you find yourself repeatedly implementing feature after feature, keeping your focus with ease for long periods of time
- Mastering the ins and outs of modern Python string formatting
- How to rapidly set up effective logging for scripts and small programs...
- ... and how to create rich, powerful, sophisticated logger subsystems, to meet the considerably greater logging needs of mission-critical Python applications
- How to fully leverage Python's exception and error model... giving you a detailed understanding even experienced Python developers often lack, and putting some of the most powerfully Pythonic exception-handling patterns in your toolbox
- And many more topics covered throughout the book.
Includes the Next Edition, FOR FREE
On top of this, your purchase of the digital edition - either by itself, or via the "digital upgrade" on the print book - gets you lifetime free access to all future digital editions and updates. Planned additions and extensions for the future include:
- More advanced ways to use Python’s object model
- Additional powerful functional programming patterns and techniques
- Leveraging Python’s built-in exception hierarchy... Potent exception patterns... and avoidable antipatterns
- Leveraging more of Python’s useful data structures
- Significant expansions to several existing chapters and previously covered topics
- And much more.
These are made available to you as frequently as they are finished, before the official release of the next edition. The priority of each new chapter and topic, and the final list of what will even make it into the book, depends on feedback from existing readers like you.
Zero Risk "Money-Back" Guarantee
It's important you are not just completely satisfied, but absolutely delighted with the value you receive from reading "Powerful Python". This is why I have invested nearly four years (so far!) writing, re-writing, re-re-writing, getting feedback from working developers, and then - based on their tough but honest feedback - tearing out whole chapters and starting from scratch. Honestly, it feels like I've written three books, not just one.
But none of that matters. The only thing that does is that you are more than happy with the result... that you feel your hard-earned money - and even more valuable time - are well invested.
While I can't give you back your time, I can and will happily refund a full 100% of your purchase price of the digital edition if you are not completely satisfied, delighted, and supremely happy with the value you've gained. Take all the time you need over 45 days to read and study the book, and put it into practice. If it didn't live up to this standard for you, simply contact customer service within this period to get your immediate, no-hassle refund. You can even keep the current digital edition for your trouble. (Different terms apply to the print book - see Amazon's return policy for details.)
Powerful Python eBook
Instant digital access, DRM-free.
Free upgrade to next edition.
Early access to new chapters.
And a zero-risk guarantee.
Questions and Answers
- What version(s) of Python does this book support?
Short answer: the focus is Python 3.5 and later, with full support for Python 2.7 too. I'll explain:
The goal of this book is to help you excel with Python - in the present, and for the foreseeable future. It's fascinating that the structure of quality Python software, and those patterns and strategies which work exceptionally well in the real world, are surprisingly independent of the version.
Most of the many code examples in the book are targeted to Python 3; nearly all will work with Python 3.4, 3.5 or 3.6. And since many people are still using Python 2.7, the book calls out its differences as we go along - sometimes in footnotes, sometimes in whole supplementary sections.
- But I just use Python 2!
You're covered. Nearly everything in the book applies 100% to your Python 2.7 code, except for some differences in syntax. Where differences exist, they are explained alongside, in footnotes and sub-sections. If you're using 2.6, you'll find most of it applies as well, and you'll be very well prepared when you upgrade.
(And remember, with the digital version, you are completely protected by the money-back guarantee.)
- How long is the book?
- The print book has a bit over 200 pages of main matter (excluding table of contents, index, etc.) The digital version's page count is slightly different, since the page size (and hence, number of words per page) is different.
- What's the digital book's format, exactly?
A regular PDF file, in printable US letter format. To make it easiest on you, the reader, it has no DRM or password protection. Files are watermarked with your email address.
Other formats like epub, mobi and printable A4 are planned soon; when available, you'll have immediate access to all of them.
- I'm... not a fan of snakes. Your book cover gives me the willies.
- I made an alternate cover option just for you.
Full Book Contents
1 Doing More with Python
1.1 Python Versions
1.2 Python Application Environments
1.3 Python Package Management
2 Scaling With Generators
2.1 Iteration in Python
2.2 Generator Functions
2.3 Generator Patterns and Scalable Composability
2.4 Python is Filled With Iterators
2.5 The Iterator Protocol
3 Creating Collections with Comprehensions
3.1 List Comprehensions
3.2 Formatting For Readability (And More)
3.3 Multiple Sources and Filters
3.4 Comprehensions and Generators
3.5 Dictionaries, Sets, and Tuples
3.6 Limits of Comprehensions
4 Advanced Functions
4.1 Accepting & Passing Variable Arguments
4.2 Functions As Objects
4.3 Key Functions in Python
5.1 The Basic Decorator
5.2 Data In Decorators
5.3 Decorators That Take Arguments
5.4 Class-based Decorators
5.5 Decorators For Classes
5.6 Preserving the Wrapped Function
6 Exceptions and Errors
6.1 The Basic Idea
6.2 Exceptions Are Objects
6.3 Raising Exceptions
6.4 Catching And Re-raising
6.5 The Most Diabolical Python Anti-Pattern
7 Classes and Objects: Beyond The Basics
7.1 Quick Note on Python 2
7.3 The Factory Patterns
7.4 The Observer Pattern
7.5 Magic Methods
7.6 Rebelliously Misusing Magic Methods
8 Automated Testing and TDD
8.1 What is Test-Driven Development?
8.2 Unit Tests And Simple Assertions
8.3 Fixtures And Common Test Setup
8.4 Asserting Exceptions
8.5 Using Subtests
8.6 Final thoughts
9 String Formatting
9.1 Replacing Fields
9.2 Number Formats (and "Format Specs")
9.3 Width, Alignment, and Fill
9.5 Percent Formatting
10 Logging in Python
10.1 The Basic Interface
10.2 Configuring The Basic Interface
10.3 Passing Arguments
10.4 Beyond Basic: Loggers
10.5 Log Destinations: Handlers and Streams
10.6 Logging to Multiple Destinations
10.7 Record Layout with Formatters
11 What's Next?