Статьи, новости и советы по Python, page 3

Iterators and Iterables in Python: Run Efficient Iterations

Python’s iterators and iterables are two different but related tools that come in handy when you need to iterate over a data stream or container. Iterators power and control the iteration process, while iterables typically hold data that you want to iterate over one value at a time.

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.

Python 3.11: Cool New Features for You to Try

Python 3.11 was published on October 24, 2022. This latest version of Python is faster and more user-friendly. After seventeen months of development, it’s now ready for prime-time use. As in every version, Python 3.11 comes with lots of improvements and changes. You can see a list of all of them in the documentation. Here, you’ll explore the coolest and most impactful new features.

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.

ProcessPoolExecutor in Python: The Complete Guide

The ProcessPoolExecutor allows you to create and manage process pools in Python. Although the ProcessPoolExecutor has been available since Python 3.2, it is not widely used, perhaps because of misunderstandings of the capabilities and limitations of Processes and Threads in Python.

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.

Automatically Retrying Failed Celery Tasks

In this article, we'll look at how to automatically retry failed Celery tasks.

Building a Weather Application in Python

A video in which a full-fledged application in Python and Django is created from scratch, allowing you to receive information about weather conditions in various cities of the world.