Episode 104: Building a Hash Table in Python and Thoughtful REST API Design
The Real Python Podcast
Apr 01, 2022 53m
Do you understand how a hash table works? What if you could learn about building one while practicing test-driven development? What are best practices when designing a REST API? This week on the show, Christopher Trudeau is here, and he’s brought another batch of PyCoder’s Weekly articles and projects.
Episode Sponsor:
We talk about the recent Real Python article “Build a Hash Table in Python With TDD.” The tutorial shows how to implement a hash table prototype from scratch in Python. It also provides a hands-on crash course in test-driven development.
Christopher shares an article on designing REST APIs and provides some of his own best practices. We cover authentication implementation, good naming conventions, versioned APIs, and ways to specify dates.
We cover several other articles and projects from the Python community, including a news roundup, a PEP on removing dead batteries from the standard library, a comparison of the Python list vs tuple, a guide to writing user-friendly CLIs in Python, just enough Cython to be useful, a cross-platform TUI and ASCII animation package, and code for running black
on Python code blocks in documentation files.
Course Spotlight: Command Line Interfaces in Python
Command-line arguments are the key to converting your programs into useful and enticing tools that are ready to be used in the terminal of your operating system. In this course, you’ll learn their origins, standards, and basics, and how to implement them in your program.
Topics:
- 00:00:00 – Introduction
- 00:02:23 – PEP 594: Removing Dead Batteries From the Standard Library
- 00:05:33 – Python 3.10.3, 3.9.11, 3.8.13, and 3.7.13 Now Available
- 00:08:37 – EuroPython 2022: Ticket Sales Open
- 00:09:34 – Python list vs tuple Comparison
- 00:12:19 – How to Write User-Friendly CLIs in Python
- 00:20:14 – Sponsor: Anvil
- 00:20:55 – Build a Hash Table in Python With TDD
- 00:26:11 – Just Enough Cython to Be Useful
- 00:36:21 – Video Course Spotlight
- 00:37:45 – How to Design Better REST APIs
- 00:47:10 – blacken-docs: Run black on Python Code Blocks within Documentation Files
- 00:49:09 – asciimatics: Cross Platform TUI and ASCII Animation Package
- 00:52:03 – Thanks and goodbye
News:
- PEP 594: Removing Dead Batteries From the Standard Library
- Python 3.10.3, 3.9.11, 3.8.13, and 3.7.13 Now Available
- EuroPython 2022: Ticket Sales Open
Topic Links:
- Python list vs tuple Comparison – Learn how
list
andtuple
are similar and how they’re different, including storage and speed differences and how to choose between them. - How to Write User-Friendly CLIs in Python – Learn how to write user-friendly command-line interface applications and an overview of several of the popular CLI libraries:
argparse
,Click
,Typer
,Docopt
, andFire
. - Build a Hash Table in Python With TDD – In this step-by-step tutorial, you’ll implement the classic hash table data structure using Python. Along the way, you’ll learn how to cope with various challenges such as hash code collisions while practicing test-driven development (TDD).
- Just Enough Cython to Be Useful – Cython is a superset of Python designed to give C-like performance. Ever wanted to learn the basics? This article shows you how to get started.
- How to Design Better REST APIs – Fifteen language-agnostic tips on REST API design, including good naming conventions, ways to specify dates, versioned APIs, authentication keys, pagination, and when to use which HTTP methods.
Projects:
- blacken-docs: Run black on Python Code Blocks in Documentation Files
- asciimatics: Cross Platform TUI and ASCII Animation Package
Additional Links:
- Command Line Interface Guidelines - An Open-Source Guide
- How to Build Command Line Interfaces in Python With argparse – Real Python
- Command Line Interfaces in Python – Real Python
- Language Basics — Cython 3.0.0a10 documentation
- Building HTTP APIs With Django REST Framework – Real Python
- Python Timer Functions: Three Ways to Monitor Your Code – Real Python