{"id":30612689,"url":"https://github.com/willtheorangeguy/pytricks-archive","last_synced_at":"2026-03-04T01:15:59.733Z","repository":{"id":54723055,"uuid":"522626379","full_name":"willtheorangeguy/PyTricks-Archive","owner":"willtheorangeguy","description":"An archive of the 🐍PyTricks featured in Dan Badder's Real Python email newsletter.","archived":false,"fork":false,"pushed_at":"2026-02-05T17:36:38.000Z","size":23923,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-06T03:35:52.105Z","etag":null,"topics":["hacktoberfest","python","pytricks","tips","tricks"],"latest_commit_sha":null,"homepage":"https://willtheorangeguy.github.io/PyTricks-Archive/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willtheorangeguy.png","metadata":{"funding":{"github":["willtheorangeguy"],"custom":["https://paypal.me/wvdg44"]},"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-08T16:28:21.000Z","updated_at":"2026-02-05T17:37:22.000Z","dependencies_parsed_at":"2025-08-30T05:49:18.794Z","dependency_job_id":null,"html_url":"https://github.com/willtheorangeguy/PyTricks-Archive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willtheorangeguy/PyTricks-Archive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willtheorangeguy%2FPyTricks-Archive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willtheorangeguy%2FPyTricks-Archive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willtheorangeguy%2FPyTricks-Archive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willtheorangeguy%2FPyTricks-Archive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willtheorangeguy","download_url":"https://codeload.github.com/willtheorangeguy/PyTricks-Archive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willtheorangeguy%2FPyTricks-Archive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30067982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T01:03:42.280Z","status":"ssl_error","status_checked_at":"2026-03-04T01:03:23.410Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","python","pytricks","tips","tricks"],"created_at":"2025-08-30T05:35:12.624Z","updated_at":"2026-03-04T01:15:59.704Z","avatar_url":"https://github.com/willtheorangeguy.png","language":"Python","funding_links":["https://github.com/sponsors/willtheorangeguy","https://paypal.me/wvdg44","https://paypal.me/wvdg44?country.x=CA\u0026locale.x=en_US"],"categories":[],"sub_categories":[],"readme":"\u003c!-- Logo --\u003e\n\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/docs/images/logo.png\" alt=\"PyTricks Archive\"\u003e\n  \u003cbr\u003e\n  PyTricks Archive\n  \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003c!-- Copy --\u003e\n\u003ch4 align=\"center\"\u003eAn archive of the 🐍PyTricks featured in Dan Badder's Real Python email newsletter.\u003c/h4\u003e\n\n\u003c!-- Badges --\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- Stability --\u003e\n  \u003cimg alt=\"GitHub Pages State\" src=\"https://github.com/willtheorangeguy/PyTricks-Archive/actions/workflows/pages/pages-build-deployment/badge.svg?branch=gh-pages\"\u003e\n  \u003c!--Gitleaks--\u003e\n  \u003cimg alt=\"Gitleaks State\" src=\"https://github.com/willtheorangeguy/PyTricks-Archive/actions/workflows/gitleaks.yml/badge.svg\"\u003e\n  \u003c!-- Issues --\u003e\n  \u003cimg alt=\"GitHub Issues\" src=\"https://img.shields.io/github/issues/willtheorangeguy/PyTricks-Archive\"\u003e\n  \u003c!-- Pull Requests --\u003e\n  \u003cimg alt=\"GitHub Pull Requests\" src=\"https://img.shields.io/github/issues-pr/willtheorangeguy/PyTricks-Archive\"\u003e\n  \u003c!-- Discord --\u003e\n  \u003cimg alt=\"Discord Server ID\" src=\"https://img.shields.io/discord/1012602070001520710\"\u003e\n\u003c/div\u003e\n\n\u003c!-- Navigation --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e •\n  \u003ca href=\"#download\"\u003eDownload\u003c/a\u003e •\n  \u003ca href=\"#how-to-use\"\u003eHow To Use\u003c/a\u003e •\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e •\n  \u003ca href=\"#credits\"\u003eCredits \u0026 Contributors\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!-- Screenshot(s) --\u003e\n\n![screenshot](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/docs/images/welcome.gif)\n\n## Key Features\n\n- Archive of all PyTricks.\n- Table of contents available.\n- Available as Python `.py` files, or on a website.\n- Website links to specific PyTricks.\n- Cross platform.\n\n## Download\n\nYou can **[download](https://github.com/willtheorangeguy/PyTricks-Archive/archive/refs/heads/main.zip) the `main` branch archive** to view the Python `.py` files or **[download](https://github.com/willtheorangeguy/PyTricks-Archive/archive/refs/heads/gh-pages.zip) the `gh-pages` branch archive** run the website locally.\n\n## How To Use\n\nEach PyTrick has a name that relates to the title of the newsletter, and you can find all of the tricks in the [`PyTricks`](https://github.com/willtheorangeguy/PyTricks-Archive/tree/main/PyTricks) folder on the Python. They are also available [on the website](https://willtheorangeguy.github.io/PyTricks-Archive/)! Below is a table of contents (sorted alphabetically by file name), with links for each PyTrick.\n\n### Table of Contents\n\n| **Original Email Titles**                                                                      | **Python**                                                                                                       | **Web**                                                                                 |\n| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |\n| [🐍PyTricks]: Peeking Behind The Bytecode Curtain                                              | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/bytecodecurtain.py)             | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#bytecodecurtain)             |\n| [🐍PyTricks]: Check if all elements in a list are equal                                        | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/checkifallequal.py)             | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#checkifallequal)             |\n| [🐍PyTricks]: Class inheritance and the issubclass() built-in                                  | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/classinheritance.py)            | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#classinheritance)            |\n| [🐍PyTricks]: contextlib.suppress                                                              | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/contextlib.suppress.py)         | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#contextlib)                  |\n| [🐍PyTricks]: CPython easter egg                                                               | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/cpythoneasteregg.py)            | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#cpythoneasteregg)            |\n| [🐍PyTricks]: Emulate switch/case statements                                                   | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/emulateswitchcasestatements.py) | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#emulateswitchcasestatements) |\n| [🐍PyTricks]: Python 3.3+ has a new \"faulthandler\" std lib module                              | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/faulthandler.py)                | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#faulthandler)                |\n| [🐍PyTricks]: Finding the most common elements in an iterable                                  | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/findmostcommonelement.py)       | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#findmostcommonelement)       |\n| [🐍PyTricks]: \"for\" (and \"while\") loops can have an \"else\" branch?!                            | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/forandwhileelsebranch.py)       | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#forandwhileelsebranch)       |\n| [🐍PyTricks]: Forced keyword-only parameters in Python 3.x                                     | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/forcedkeywordparameters.py)     | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#forcedkeywordparameters)     |\n| [🐍PyTricks]: Function argument unpacking in Python                                            | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/functionargumentunpacking.py)   | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#functionargumentunpacking)   |\n| [🐍PyTricks]: Python's built-in HTTP server                                                    | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/httpserver.py)                  | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#httpserver)                  |\n| [🐍PyTricks]: Python's shorthand for in-place value swapping                                   | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/inplacevalueswapping.py)        | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#inplacevalueswapping)        |\n| [🐍PyTricks]: Working with IP addresses in Python 3                                            | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/ipaddresses.py)                 | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#ipaddresses)                 |\n| [🐍PyTricks]: \"is\" vs \"==\"                                                                     | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/isvsequals.py)                  | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#isvsequals)                  |\n| [🐍PyTricks]: itertools.permutations()                                                         | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/itertools.permutations.py)      | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#itertools)                   |\n| [🐍PyTricks]: Lambda Functions                                                                 | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/lambdafunctions.py)             | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#lambdafunctions)             |\n| [🐍PyTricks]: Python's list comprehensions are awesome                                         | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/listcomprehensions.py)          | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#listcomprehensions)          |\n| [🐍PyTricks]: Python list slice syntax fun                                                     | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/listslice.py)                   | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#listslice)                   |\n| [🐍PyTricks]: @classmethod vs @staticmethod vs \"plain\" methods                                 | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/methodscomparison.py)           | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#methodscomparison)           |\n| [🐍PyTricks]: Multiple sets of kwargs in Python 3.5+                                           | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/multiplekwargs.py)              | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#multiplekwargs)              |\n| [🐍PyTricks]: Python's namedtuples can be a great alternative to defining a class manually     | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/namedtuplealternative.py)       | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#namedtuplealternative)       |\n| [🐍PyTricks]: You can use \"json.dumps()\" to pretty-print Python dicts                          | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/prettyprintdicts.py)            | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#prettyprintdicts)            |\n| [🐍PyTricks]: The get() method on Python dicts and its \"default\" arg                           | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/pythondictgetmethod.py)         | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#pythondictgetmethod)         |\n| [🐍PyTricks]: When To Use **repr**\\_\\_** vs **str\\*\\*?                                         | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/reprvsstr.py)                   | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#reprvsstr)                   |\n| [🐍PyTricks]: How to sort a Python dict by value                                               | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/sortdictbyvalue.py)             | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#sortdictbyvalue)             |\n| [🐍PyTricks]: Different ways to test multiple flags at once in Python                          | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/testmultipleflags.py)           | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#testmultipleflags)           |\n| [🐍PyTricks]: Measure the execution time of small bits of Python code with the \"timeit\" module | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/timeit.py)                      | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#timeit)                      |\n| [🐍PyTricks]: Python 3.5+ type annotations                                                     | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/typeannotations.py)             | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#typeannotations)             |\n| [🐍PyTricks]: Python 3 allows unicode variable names                                           | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/unicodevariablename.py)         | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#unicodevariablename)         |\n| [🐍PyTricks]: Avoid version conflicts with Virtual Environments                                | [Python](https://github.com/willtheorangeguy/PyTricks-Archive/blob/main/PyTricks/virtualenvs.py)                 | [Web](https://willtheorangeguy.github.io/PyTricks-Archive/#virtualenvs)                 |\n\n## Contributing\n\nPlease contribute using [GitHub Flow](https://guides.github.com/introduction/flow). Create a branch, add commits, and [open a pull request](https://github.com/willtheorangeguy/PyTricks-Archive/compare).\n\nPlease read [`CONTRIBUTING`](CONTRIBUTING.md) for details on our [`CODE OF CONDUCT`](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us.\n\n## Credits\n\nThis software uses the following open source packages, projects, services or websites:\n\n\u003c!-- Credits Table --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth align=\"center\"\u003e\u003cimg src=\"https://applets.imgix.net/https%3A%2F%2Fassets.ifttt.com%2Fimages%2Fchannels%2F2107379463%2Ficons%2Fmonochrome_large.png?w=240\u0026h=240\u0026s=8a19bbc158996d098e2fb18310ba7f33\" width=\"150\" height=\"150\" alt=\"GitHub\"/\u003e\u003c/th\u003e\n    \u003cth align=\"center\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/182px-Python-logo-notext.svg.png\" width=\"150\" height=\"150\" alt=\"Real Python\"/\u003e\u003c/th\u003e\n    \u003cth align=\"center\"\u003e\u003cimg src=\"https://s3-eu-west-1.amazonaws.com/tpd/logos/60ae96c09f902b0001b4569c/0x0.png\" width=\"150\" height=\"150\" alt=\"Bunny Fonts\"/\u003e\u003c/th\u003e\n    \u003cth align=\"center\"\u003e\u003cimg src=\"https://assets.simpleanalytics.com/press/logo-ratio-1-1/square.svg\" width=\"150\" height=\"150\" alt=\"Simple Analytics\"/\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003eGitHub\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eReal Python\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eBunny Fonts\u003c/td\u003e\n    \u003ctd align=\"center\"\u003eSimple Analytics\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/\"\u003eWeb\u003c/a\u003e - \u003ca href=\"https://github.com/pricing\"\u003ePlans\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://realpython.com/\"\u003eWeb\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://fonts.bunny.net/\"\u003eWeb\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://simpleanalytics.com/?referral=willtheorangeguy\"\u003eWeb\u003c/a\u003e - \u003ca href=\"https://www.simpleanalytics.com/pricing\"\u003ePlans\u003c/a\u003e\u003c/td\u003e\n\u003c/table\u003e\n\n## Contributors\n\n- [@willtheorangeguy](https://github.com/willtheorangeguy) - Sponsor on [PayPal](https://paypal.me/wvdg44?country.x=CA\u0026locale.x=en_US)\n\n## You may also like...\n\n- [Running Calculator](https://github.com/willtheorangeguy/Running-Calculator) - A running speed calculator for any unit of distance.\n- [Python Logo Widgets](https://github.com/willtheorangeguy/Python-Logo-Widgets) - Python Powered Logo widgets that can be added to any GUI project.\n- [Random Lotto Number Chooser](https://github.com/willtheorangeguy/Random-Lotto-Number-Chooser) - Randomly pick lucky lotto numbers.\n\n## License\n\nMy work on this project is released under the Creative Commons Attribution 4.0 International Public License, which can be found in the [`LICENSE`](LICENSE.md) file. The PyTricks are copyright [Dan Badder of Real Python](https://realpython.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilltheorangeguy%2Fpytricks-archive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilltheorangeguy%2Fpytricks-archive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilltheorangeguy%2Fpytricks-archive/lists"}