#590 – AUGUST 15, 2023
How to Annotate Methods That Return self
In this tutorial, you’ll learn how to use the Self type hint in Python to annotate methods that return an instance of their own class. You’ll gain hands-on experience with type hints and annotations of methods that return an instance of their class, making your code more readable and maintainable.
REAL PYTHON
Creating a Context Manager in Python
Objects with __enter__
and __exit__
methods can be used as context managers in Python. This article (and screencast) explains most of what you’ll want to know when creating your own context managers.
TREY HUNNER • Shared by Trey Hunner
If App Signup is Giving You Headaches, Here’s Your Answer: FusionAuth’s Modern Guide to OAuth
Our Modern Guide to OAuth is chock full of real-world examples, without fluffy BS. We made it, you learn it. It’s a win-win. And when you’re ready, you can spin up an instance of FusionAuth for FREE in just five minutes →
FUSIONAUTH sponsor
PEP 723: Embedding pyproject.toml
in Single-File Scripts
This PEP proposes a metadata format which a single-file script can use to specify dependency and tool information for IDEs and external development tools. It replaces PEP 722.
PYTHON.ORG
PyPI: 2FA Enforcement for New User Registrations
PYPI.ORG
PSF Announces New PyPI Safety & Security Engineer
PYTHON SOFTWARE FOUNDATION
Python 3.12.0 RC 1 Released
CPYTHON DEV BLOG
Articles & Tutorials
Prompt Engineering: A Practical Example
Learn prompt engineering techniques with a practical, real-world project to get better results from large language models. This tutorial covers zero-shot and few-shot prompting, delimiters, numbered steps, role prompts, chain-of-thought prompting, and more. Improve your LLM-assisted projects today.
REAL PYTHON
Why Static Languages Suffer From Complexity
An extremely detailed, deep dive on how static type systems impact the consistency of languages. Hirrolot compares a variety of lesser known languages to see the consequences of their decisions. See also the associated Hacker News discussion.
HIRROLOT
Companies like GitLab, Snowflake, and Slack Scan Their Code for Vulnerabilities Using Semgrep
Scan your code and dependencies for security vulnerabilities for free with Semgrep – the trusted OSS tool used by top companies like GitLab, Snowflake, and Slack. No security expertise needed, simply add your project and let Semgrep do the work in just minutes →
SEMGREP sponsor
Python’s list
: A Deep Dive With Examples
In this tutorial, you’ll dive deep into Python’s lists. You’ll learn how to create them, update their content, populate and grow them, and more. Along the way, you’ll code practical examples that will help you strengthen your skills with this fundamental data type in Python.
REAL PYTHON
A Complete Comparison of Sorting Algorithms
An comprehensive comparison on the performance of 9 major Sorting Algorithms and how well they perform under varying circumstances. The aim of the article is to show you where each type of Algorithms shines, and where it does badly.
CODERSLEGACY.COM • Shared by Raahim Siddiqi
Support Bootstrap-Alerts in Python-Markdown
If you’re using Markdown on your blog, or any website, a conversion pipeline allows you to create your own rules and widgets. This article shows you how to integrate Bootstrap Alert boxes into a Markdown workflow.
FLORIAN DAHLITZ • Shared by Florian Dahlitz
How a Simple Import Can Modify the Interpreter
This article shows a sample module that swaps the values for 8 and 9, not something generally recommended. Learn how side effects from an import can impact your code and just what the integer object cache is.
KEN SCHUTTE
Does Elegance Matter?
In this article, the author explains why he thinks that elegance should be a fundamental driver when you are writing (Python) code, and gives a few tips on how to write elegant code.
MATHSPP.COM • Shared by Rodrigo Girão Serrão
Why Python Is Amazing
This opinion piece by Jos is a counter to the “its a terrible language” posts you come across once and a while. Read why Jos thinks Python is amazing.
JOS VISSER
Llama From Scratch
This blog post provides step by step instructions on how to implement llama from scratch, using a dramatically scaled-down version for training.
BRIAN KITANO
Learn How to Deploy Scientific AI Models to Edge Environments, Using OpenVINO Model Server
🤔 Can cell therapy and AI be used together? Learn how to efficiently build and deploy scientific AI models using open-source technologies with Beckman Coulter Life Sciences at our upcoming DevCon OpenVINO webinar. #DevCon2023
INTEL CORPORATION sponsor
Adversarial Attacks on Aligned LLMs
Deep CS paper on how to abuse Large Language Models and work around restrictions where the model is refusing to answer.
ZOU, WANG, KOLTER, & FREDRIKSON
2022 PSF Annual Report
The annual report from the Python Software Foundation details all the changes and events at the PSF last year.
PYTHON.ORG
Projects & Code
dpv: Alternative to pyenv-virtualenv
and virtualenvwrapper
GITHUB.COM/CAIOARIEDE • Shared by Caio Ariede
nodice-cli: Word List Generator With No Dependencies
GITHUB.COM/AVNIGO
briefcase: Convert Python to a Native Application
GITHUB.COM/BEEWARE
django_simple_notification: REST Notification System
GITHUB.COM/MAHMOUDNASSER01
pyOCD: Python for Arm Cortex-M Microcontrollers
GITHUB.COM/PYOCD
Events
Weekly Real Python Office Hours Q&A (Virtual)
August 16, 2023
REALPYTHON.COM
PyData Bristol Meetup
August 17, 2023
MEETUP.COM
PyLadies Dublin
August 17, 2023
PYLADIES.COM
DjangoConAU 2023
August 18 to August 19, 2023
DJANGOCON.COM.AU
PyCon AU 2023
August 18 to August 23, 2023
PYCON.ORG.AU
Chattanooga Python User Group
August 18 to August 19, 2023
MEETUP.COM
PyCon Latam 2023
August 24 to August 27, 2023
PYLATAM.ORG
Happy Pythoning!
This was PyCoder’s Weekly Issue #590.
View in Browser »
[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]
Source:: PyCoder’s