Goodreads helps you keep track of books you want to read.
Start by marking “Python Tricks: A Buffet of Awesome Python Features” as Want to Read:
Python Tricks: A Buffet of Awesome Python Features
Enlarge cover
Rate this book
Clear rating
Open Preview

Python Tricks: A Buffet of Awesome Python Features

4.45  ·  Rating details ·  714 ratings  ·  71 reviews

“I don’t even feel like I’ve scratched the surface of what I can do with Python”

With Python Tricks: The Book you’ll discover Python’s best practices and the power of beautiful & Pythonic code with simple examples and a step-by-step narrative.

You'll get one step closer to mastering Python, so you can write beautiful and idiomatic code that comes to you naturally.


Kindle Edition, 304 pages
Published December 6th 2017 by Dan Bader (
More Details... Edit Details

Friend Reviews

To see what your friends thought of this book, please sign up.

Reader Q&A

To ask other readers questions about Python Tricks, please sign up.

Be the first to ask a question about Python Tricks

This book is not yet featured on Listopia. Add this book to your favorite list »

Community Reviews

Showing 1-30
Average rating 4.45  · 
Rating details
 ·  714 ratings  ·  71 reviews

More filters
Sort order
Start your review of Python Tricks: A Buffet of Awesome Python Features
☘Misericordia☘ ⚡ϟ⚡⛈⚡☁ ❇️❤❣
The Pythonite way from a very savvy user.
"-": Python 2 vs 3 difs.
"+": Short and up-to-the point style
"+": Lots of cool ideas
"+": Practical implications not just 'oh yeah there's something that works somehow in P'
"+": Good explanations
"+": Many examples
Eric Nichols
Jan 01, 2018 rated it it was amazing
A quick read to fill in any gaps in your python knowledge

I'm an advanced python user and have worked at several startups, Google, and Microsoft, but I still found several tips in here that were new to me, and many others that I only knew because I'd learned them from colleagues when I worked at Google. For instance, I would usually just define an __str__ method on my custom classes and be lazy and not implement __repr__. But the book points out that if you want be lazy, just define __repr__ alon
César Bustíos
May 18, 2018 rated it really liked it
Shelves: 2018, tech
Putting the beginner stuff aside and the fact that I already knew most of the tricks, this is a well written book. Beautiful and simple.

Those iterator chains blew my mind.
Dimitrios Mistriotis
Jan 07, 2019 rated it really liked it  ·  review of another edition
Shelves: data-science
Wanted to check out this book so downloaded it. Most of the times I do this it ends up with me buying the actual book at the end so do not feel that guilty confessing this "habit". With "Python Tricks" was very early 100% sure that it would end up with a purchase which happened.

What I want from a coding book is always the same two things: (1) feel sad+happy while reading it: sad for parts of my codebase and happy that I am reading it, (2) Understand better patterns of the programming language an
Alfie Privat
Jun 03, 2018 rated it it was amazing

I have used python before but wanted to gain more advance knowledge. Fluent python is the Bible these days but it is too long (almost 800 pages). From my experience, you don’t need all language features to use a language affectively (think 80/20 rule). That is why this book was so appealing to me and it didn’t disappoint. If you want to save time and gain deeper insight into the python language, read this book.
Feb 24, 2018 rated it really liked it  ·  review of another edition
Good book. But prefer Fluent Python.
Jan Spörer
Nov 14, 2019 rated it it was amazing  ·  review of another edition
Here are my key take-aways from the book (page numbers refer to the epup version of the book, I had 157 pages in total with my "14 screen size):
-Asserts are used to catch BUGS/unrecoverable errors, not erroneous user input, and make code more maintainable and help developers. Assets will just be ignored under certain circumstances and may pose a security risk when being relied upon in production. Never use it for data validation. Use "if + raise" for validation. (p. 14)
-Use a comma after the las
Bojan Tunguz
Jan 11, 2020 rated it it was amazing  ·  review of another edition
A while ago, when I was still fairly new to Python, I stumbled upon the Dan Bader's "Real Python" newsletter. It was a very refreshing take on learning how to code. It gave a simple, yet insightful, tip each day. The approach and the substance were aimed at someone who is already familiar with the basics of Python and programming, but wanted to improve those skills in a non-formal and unsystematic way. 
So after a while I decided to purchase Dan's "Python Tricks" book. The book is written with th
Jun 07, 2018 rated it it was amazing
This was a great book to binge after attempting to read the wall-of-text that is Fluent Python. Python Tricks provides great insights into the language, while offering fun and digestible examples. Unfortunately, with the discrepancies between Python 2 and 3, it's not always the case that there's "one--and preferably only one--obvious way to do [things]"; however, Dan effectively provides the reader simple situational rules to follow in order to find the easiest/cleanest/most-Pythonic way of acco ...more
Jul 30, 2020 rated it it was amazing  ·  review of another edition
Interesting introductions for advanced python concepts.
Alex Solonenko
Jul 28, 2019 rated it it was amazing  ·  review of another edition
Book, which worth the time spent on it.

In general, this is a very good book for learning the Python programming language. There is either an experienced programmer or the only beginner is able to find something interesting and new for himself or strengthen his skills in the already known material and find out some features of the language.

The presentation of material here is great, so it reads lightly and you don't get tired of it, like of such books as Learn Python the Hard Way or Python Progr
Mochammad Hadyan
Love this book! Even for seasoned Python developer, you will be surprised how small, but exceptionally useful tricks that can help you to write Python code better.

Also, i found each chapter is fun to read in spite it is something i've already known before, because sometimes the contents radically change my paradigm when understanding the concept.

Last but not least, this can become one of the good reference book when you forget something about the Python concept (at least this is what i've done
Trung Hoang
Sep 23, 2019 rated it it was amazing  ·  review of another edition
Shelves: python
Although the book is 300 pages, it's fairly short because of the big font. As the title says, there are a lot of tricks in this book. However, I already knew most of them from YouTube videos. Saying that, It's still a great book to have. The tone of the book is quite funny and keeps it interesting.
I have to say that this book is not for beginner. You should only pick this up once you are at least familiar with the language and all the basic objects (function, list, dictionary, set, string, ...)
Tony Poerio
Nov 21, 2017 rated it it was amazing  ·  review of another edition
Good book. Concise and full and of helpful information, presented very simply. Doesn't get deep into the super-advanced language features (meta-programming, etc...). But provides very practical Python info that everyone can use on a daily basis in their programming. ...more
Jun 26, 2018 rated it it was amazing  ·  review of another edition
A great book is like a long cheatsheet simple but extremely useful examples, you can read it fast due to the large sets of examples is a very practical especially if you read it before starting a new python project.
Jun 12, 2020 rated it really liked it
It's a good book written in a very friendly manner (maybe even too friendly - too much sugar can kill you), but I found it a little too shallow. It sweeps broadly, but has only <300 pages, so there's no place (and no intention) to go deeper. Again, maybe it is a good thing - that way it's more geared towards beginners who won't be too intimidated with the content. At least most of times, because it has it's not entirely balanced difficulty spikes (data structures section, min-heap, I'm looking a ...more
Redowan Nafi
Dec 02, 2019 rated it it was amazing  ·  review of another edition
Shelves: engineering
This Python recipe targets neither the beginners nor the advanced users. Rather it is aimed towards people who have already mastered the syntax, using python for a while and want to take their skills to the next level. The author did an awesome job keeping it concise while touching a plethora of topics without making the whole thing boring!

Dive into the book if:

1. You are already familiar with basic python data structures (list, stack, set, dictionary, mutable and immutable objects).

2. You are c
Nov 29, 2020 rated it it was amazing
If you are a beginner-to-intermediate Python enthusiast who is going at it alone, without any outside support whatsoever, as long as you have a basic understanding of how Python works and have already attempted a few projects on your own, this book is truly a gem and what you should be reading next. In a very condensed form, it manages to point out a whole lot of things you may have been doing wrong, or in a suboptimal way. In essence, it's like having a very good friend standing behind you and ...more
Dec 29, 2020 rated it it was amazing  ·  review of another edition
Shelves: python
Took me a little bit over a year to read it... Which was good, if you try to read a programming book "in one session" you will forget what you read in the beginning.
I took my time, thought about each chapter and tried to apply it as soon as I read it - or at least think where I could apply it. Also, I'm not new to Python, so there were a lot of "tricks" I already know and use - but for those cases, I used the examples to verify that I really know it and it is always good to read someone else exp
Mar 22, 2019 rated it it was amazing
Good book for intermediate Python developers

It is written in a very understandable but at the same time concise style. While it assumes the reader already has a decent understanding of programming in general and skips the basics, it gets pretty detailed in medium to advanced Python syntax, patterns and useful libraries; which makes it perfect for a developer experienced in another language, but relatively new to Python. If you really want to go beyond the basics, without having to swallow the en
Apr 05, 2019 rated it it was amazing  ·  review of another edition
Excellent! This is not just a book about Python. It helps to write better code, that's for granted! There are real examples of how you should be using the language and what you should try to avoid. I even implemented 2 or 3 tricks in my own work! And explanations will be easy to understand for newcomers but at the same time it's not boring for someone who works with python for some time. And the best part - you can use it as go-to table book with hints! Because every chapter is independent from ...more
Douglas Kendyson
Asides how technically sound this book is, it’s also extremely well written. I’m so jealous of the author’s ability to make some pretty complex things easy. I’ve been developing in python for a year now and I’m glad I read this book now as opposed to at the beginning of my python journey. The author also makes a case for it not being a “beginner” beginner book, and I get it, the book just flows when you know a little more than the basics, but it’s also very helpful if you’re a beginner. I defini ...more
Apr 25, 2020 rated it it was amazing
I write a lot of Python code as a security engineer, and normally all I care about is whether or not the code works the way it was intended to, and that there are no bugs. I don't focus on code structure and clarity the way software engineers do. However after reading this book, and learning the inner workings and new features of Python, I found my self following best practices and even applying some of the tricks I learned in the book to write cleaner and less code than I used to. Overall a gre ...more
Michael Mcintyre
I picked this up, or rather, was given this, as part of a Humble Bundle. I enjoy Dan's blog, and figured his writing in this book would be on the same level. The book is great, but definitely geared towards a more beginner to intermediate level. I can only read so many articles on tuple unpacking, list comprehensions, and operator overloading. If you are looking for an approachable entry point into writing more pythonic code, this is your book. Otherwise, the newly revised Effective Python or Fl ...more
Son Dang
May 18, 2019 rated it it was amazing
Simply love it!

This is not a reference book in which you you can find all the nitty-gritty details about a method, module... Buy and read this book if you want to know leverages and tricks in Python that the author has simply and beautifully laid out.

This book, again, should not be a book for those who has not known Python yet. There must be some sufficient exposure to the language to get all the benefits that it provides.

In general, it is a great book to have
Victor Domingos
Feb 25, 2020 rated it it was amazing  ·  review of another edition
This is an interesting book about Python, but not the usual handbook or cookbook style. If you already know the basics and want to discover new details about this programming language, or if you want to check if you really have a solid grasp on it, this book will give you some insightful, bite-size, tips and tricks.

Full review:
May 10, 2020 rated it really liked it
Good reference book

Concrete knowledge and tricks about Python. Not as deep as Fluent Python but more practical and accessible. I like some of the examples which explained some complex concept well. To be honest, most of the content can be found on real python website and also his personal website.thus probably not worthwhile to pay for it. However I still bought this to show my support.
Jan 11, 2018 rated it it was amazing
Connect the dots.

Dan Bader has an elegant and informative writing style that keeps you locked in, just one more chapter, till none are left. I have been writing Python for a few years now and this book helped to connect dots for me, especially around lambda functions, decorators and classes.
Ravindra Dolas
Dec 15, 2018 rated it it was amazing
Every Emerging Python Developers should read.

Good Tricks Buffet for Everyday Python Programming, the Pythonist Way! Very helpful and recommended for beginners and intermediate level. Need more concrete example though than explaining the tricks with very simple examples. Recommended for all python programmers.
Abhishek Anand
Oct 12, 2020 rated it really liked it
A good quick read to understand some of the cool features of Python. Great for some one who picked up python through online videos or articles, as this presents a fairly comprehensive view of the capabilities of Python in theoretical but an easy to understand. This book can also become a stepping stone to perhaps more in depth books on python out there.
« previous 1 3 next »
There are no discussion topics on this book yet. Be the first to start one »

Readers also enjoyed

  • Automate the Boring Stuff with Python: Practical Programming for Total Beginners
  • Effective Python: 59 Specific Ways to Write Better Python
  • Python Crash Course: A Hands-On, Project-Based Introduction to Programming
  • Grokking Algorithms An Illustrated Guide For Programmers and Other Curious People
  • Deep Learning with Python
  • Effective Python: 90 Specific Ways to Write Better Python (Effective Software Development Series)
  • Python for Data Analysis
  • Fluent Python: Clear, Concise, and Effective Programming
  • Python for Everybody: Exploring Data in Python 3
  • Clean Code: A Handbook of Agile Software Craftsmanship
  • Natural Language Processing with Pytorch: Build Intelligent Language Applications Using Deep Learning
  • Pro Git
  • The Hacker Playbook 3: Practical Guide To Penetration Testing
  • Black Hat Python: Python Programming for Hackers and Pentesters
  • Serious Python: Black-Belt Advice on Deployment, Scalability, Testing, and More
  • Python Data Science Handbook: Tools and Techniques for Developers
  • The Pragmatic Programmer: From Journeyman to Master
  • Python Testing with Pytest: Simple, Rapid, Effective, and Scalable
See similar books…

Goodreads is hiring!

If you like books and love to build cool products, we may be looking for you.
Learn more »

News & Interviews

Ciannon Smart has been holed up in her England home since the pandemic began a year ago, but by no means has she been idle. She’s been on...
17 likes · 4 comments
“Assertions are meant to be internal self-checks for your program. They work by declaring some conditions as impossible in your code. If one of these conditions doesn’t hold, that means there’s a bug in the program.” 0 likes
“If your format strings are user-supplied, use Template Strings to avoid security issues. Otherwise, use Literal String Interpolation if you’re on Python 3.6+, and “New Style” String Formatting if you’re not.” 0 likes
More quotes…