Articles about Python

Sending Emails With Python

You probably found this tutorial because you want to send emails using Python. Perhaps you want to receive email reminders from your code, send a confirmation email to users when they create an account, or send emails to members of your organization to remind them to pay their dues. Sending emails manually is a time-consuming and error-prone task, but it’s easy to automate with Python.

The Ultimate Guide To Sets In Python

The set class is one of the key data structures in Python. It is an unordered collection of elements without duplicates. It represents, to a certain degree, a mathematical set, and many of the commonly used mathematical operations for sets exist in Python. Often the operations for sets are much faster than alternative operations with lists, thus, to write effective code, sets are essential. In this article, I will explain the ins and outs of the set class. Let’s get to it.

Python Constants: Improve Your Code's Maintainability

In programming, the term constant refers to names representing values that don’t change during a program’s execution. Constants are a fundamental concept in programming, and Python developers use them in many cases. However, Python doesn’t have a dedicated syntax for defining constants. In practice, Python constants are just variables that never change.

Parallelism, Concurrency, and AsyncIO in Python - by example

This tutorial looks at how to speed up CPU-bound and IO-bound operations with multiprocessing, threading, and AsyncIO.

Modern Python: start a project with pyenv & poetry

Here we'll look at how to use Pyenv to manage and install different versions of Python, and Poetry to manage packages and virtual environments.

Python Project Workflow

In this article, you'll glue everything together as you develop a single project from start to finish. After developing the basic project, you'll: Wire up CI/CD with GitHub Actions, Configure coverage reporting with CodeCov, Publish the package to PyPi and the docs to Read the Docs, Update PyPI and Read the Docs via GitHub Actions

Python Project Setup – Virtual Environments and Package Management

Virtual Environments are isolated Python environments that have their own site-packages. Basically, it means that each virtual environment has its own set of dependencies to third-party packages usually installed from PyPI.

Advanced usage of Python requests - timeouts, retries, hooks

The Python HTTP library requests is probably my favourite HTTP utility in all the languages I program in. It's simple, intuitive and ubiquitous in the Python community. Most of the programs that interface with HTTP use either requests or urllib3 from the standard library.

Understanding Decorators in Python

Decorators are wrappers around Python functions (or classes) that change how these classes work. A decorator abstracts its own functioning as far away as possible. The Decorator notation is designed to be as minimally invasive as possible. A developer can develop his code within his domain as he is used to and only use the decorator to extend the functionality. Because this sounds very abstract, let’s look at some examples.

Understanding Attributes, Dicts and Slots in Python

Python is a very dynamic language by nature. Variables do not need to be declared and can be added as attributes almost everywhere.

A Comprehensive Guide to Slicing in Python

In Python, some objects like strs or lists can sliced. For example, you can get the first element of a list or a string.