'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. Learning the ins and outs of Python is difficult-and with this book you'll be able to focus on the practical skills that really matter. Discover the 'hidden gold' in Python's standard library and start writing clean and Pythonic code today. Who Should Read This Book: - If you're wondering which lesser known parts in Python you should know about, you'll get a roadmap with this book. Discover cool (yet practical!) Python tricks and blow your coworkers' minds in your next code review. - If you've got experience with legacy versions of Python, the book will get you up to speed with modern patterns and features introduced in Python 3 and backported to Python 2. - If you've worked with other programming languages and you want to get up to speed with Python, you'll pick up the idioms and practical tips you need to become a confident and effective Pythonista. - If you want to make Python your own and learn how to write clean and Pythonic code, you'll discover best practices and little-known tricks to round out your knowledge I dont even feel like Ive scratched the surface of what I can do with Python With Python The Book youll discover Pythons 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. Learning the ins and outs of Python is difficultand with this book you'll be able to focus on the practical skills that really matter. Discover the hidden gold in Pythons standard library and start writing clean and Pythonic code today. Who Should Read This If youre wondering which lesser known parts in Python you should know about, youll get a roadmap with this book. Discover cool (yet practical!) Python tricks and blow your coworkers minds in your next code review.If youve got experience with legacy versions of Python, the book will get you up to speed with modern patterns and features introduced in Python 3 and backported to Python 2.If youve worked with other programming languages and you want to get up to speed with Python, youll pick up the idioms and practical tips you need to become a confident and effective Pythonista.If you want to make Python your own and learn how to write clean and Pythonic code, youll discover best practices and little-known tricks to round out your knowledge. What Python Developers Say About The "I kept thinking that I wished I had access to a book like this when I started learning Python many years ago." Mariatta Wijaya, Python Core Developer "This book makes you write better Python code!" Bob Belderbos, Software Developer at Oracle "Far from being just a shallow collection of snippets, this book will leave the attentive reader with a deeper understanding of the inner workings of Python as well as an appreciation for its beauty." Ben Felder, Pythonista "It's like having a seasoned tutor explaining, well, tricks!" Daniel Meyer, Sr. Desktop Administrator at Tesla Inc. Contents Foreword Introduction What's a Python Trick? What This Book Will Do for You How to Read This Book Patterns for Cleaner Python Covering Your A** With Assertions Complacent Comma Placement Context Managers and the with Statement Underscores, Dunders, and More A Shocking Truth About String Formatting The Zen of Python Easter Egg Effective Functions Python's Functions Are First-Class Lambdas Are Single-Expression Functions The Power of Decorators Fun With *args and **kwargs Function Argument Unpacking Nothing to Return Here Classes & OOP Object Comparisons: is vs == String Conversion (Every Class Needs a __repr__) Defining Your Own Exception Classes Cloning Objects for Fun and Profit Abstract Base Classes Keep Inheritance in Check What Namedtuples Are Good For Class vs Instance Variable Pitfalls Instance, Class, and Static Methods Demystified Common Data Structures in Python Dictionaries, Maps, and Hashtables Array Data Structures Records, Structs, and Data Transfer Objects Sets and Multisets Stacks (LIFOs) Queues (FIFOs) Priority Queues Looping & Iteration Writing Pythonic Loops Comprehending Comprehensions List Slicing Tricks and the Sushi Operator Beautiful Iterators Generators Are Simplified Iterators Generator Expressions Iterator Chains Dictionary Tricks Dictionary Default Values Sorting Dictionaries for Fun and Profit Emulating Switch/Case Statements With Dicts The Craziest Dict Expression in the West So Many Ways to Merge Dictionaries Dictionary Pretty-Printing Pythonic Productivity Techniques Exploring Python Modules and Objects Isolating Project Dependencies With Virtualenv Peeking Behind the Bytecode Curtain Closing Thoughts Free Weekly Tips for Python Developers PythonistaCafe: A Community for Python Developers "Learning the ins and outs of Python is difficult--and with this book you'll be able to focus on the practical skills that really matter. Discover the 'hidden gold' in Python’s standard library and start writing clean and Pythonic code today. 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."--Provided by publisher