Key Features • Download • How To Use • Contributing • Credits & Contributors
- Archive of all PyTricks.
- Table of contents available.
- Available as Python
.py
files, or on a website. - Website links to specific PyTricks.
- Cross platform.
You can download the main
branch archive to view the Python .py
files or download the gh-pages
branch archive run the website locally.
Each PyTrick has a name that relates to the title of the newsletter, and you can find all of the tricks in the PyTricks
folder on the Python. They are also available on the website! Below is a table of contents (sorted alphabetically by file name), with links for each PyTrick.
Original Email Titles | Python | Web |
---|---|---|
[🐍PyTricks]: Peeking Behind The Bytecode Curtain | Python | Web |
[🐍PyTricks]: Check if all elements in a list are equal | Python | Web |
[🐍PyTricks]: Class inheritance and the issubclass() built-in | Python | Web |
[🐍PyTricks]: contextlib.suppress | Python | Web |
[🐍PyTricks]: CPython easter egg | Python | Web |
[🐍PyTricks]: Emulate switch/case statements | Python | Web |
[🐍PyTricks]: Python 3.3+ has a new "faulthandler" std lib module | Python | Web |
[🐍PyTricks]: Finding the most common elements in an iterable | Python | Web |
[🐍PyTricks]: "for" (and "while") loops can have an "else" branch?! | Python | Web |
[🐍PyTricks]: Forced keyword-only parameters in Python 3.x | Python | Web |
[🐍PyTricks]: Function argument unpacking in Python | Python | Web |
[🐍PyTricks]: Python's built-in HTTP server | Python | Web |
[🐍PyTricks]: Python's shorthand for in-place value swapping | Python | Web |
[🐍PyTricks]: Working with IP addresses in Python 3 | Python | Web |
[🐍PyTricks]: "is" vs "==" | Python | Web |
[🐍PyTricks]: itertools.permutations() | Python | Web |
[🐍PyTricks]: Lambda Functions | Python | Web |
[🐍PyTricks]: Python's list comprehensions are awesome | Python | Web |
[🐍PyTricks]: Python list slice syntax fun | Python | Web |
[🐍PyTricks]: @classmethod vs @staticmethod vs "plain" methods | Python | Web |
[🐍PyTricks]: Multiple sets of kwargs in Python 3.5+ | Python | Web |
[🐍PyTricks]: Python's namedtuples can be a great alternative to defining a class manually | Python | Web |
[🐍PyTricks]: You can use "json.dumps()" to pretty-print Python dicts | Python | Web |
[🐍PyTricks]: The get() method on Python dicts and its "default" arg | Python | Web |
[🐍PyTricks]: When To Use repr__** vs **str**? | Python | Web |
[🐍PyTricks]: How to sort a Python dict by value | Python | Web |
[🐍PyTricks]: Different ways to test multiple flags at once in Python | Python | Web |
[🐍PyTricks]: Measure the execution time of small bits of Python code with the "timeit" module | Python | Web |
[🐍PyTricks]: Python 3.5+ type annotations | Python | Web |
[🐍PyTricks]: Python 3 allows unicode variable names | Python | Web |
[🐍PyTricks]: Avoid version conflicts with Virtual Environments | Python | Web |
Please contribute using GitHub Flow. Create a branch, add commits, and open a pull request.
Please read CONTRIBUTING
for details on our CODE OF CONDUCT
, and the process for submitting pull requests to us.
This software uses the following open source packages, projects, services or websites:
GitHub | Real Python | Bunny Fonts | Simple Analytics |
Web - Plans | Web | Web | Web - Plans |
- @willtheorangeguy - Sponsor on PayPal
- Running Calculator - A running speed calculator for any unit of distance.
- Python Logo Widgets - Python Powered Logo widgets that can be added to any GUI project.
- Random Lotto Number Chooser - Randomly pick lucky lotto numbers.
My work on this project is released under the Creative Commons Attribution 4.0 International Public License, which can be found in the LICENSE
file. The PyTricks are copyright Dan Badder of Real Python.