Python tutorials

When Python can’t thread: a deep-dive into the GIL’s impact

Most computers these days come with multiple cores, allowing multiple threads to run computations in parallel. And even without multiple cores, you can have concurrency, for example one thread waiting on disk while another runs code on the CPU. The ability to use parallelism can be critical to scaling your application—or making your data processing finish faster. Unfortunately, in many cases Python can only run one thread at a time, due to what’s know as the Global Interpreter Lock (“GIL”). […]

Read more

Why Is It Important to Close Files in Python?

At some point in your Python coding journey, you learn that you should use a context manager to open files. Python context managers make it easy to close your files once you’re done with them: with open(“hello.txt”, mode=”w”) as file: file.write(“Hello, World!”) The with statement initiates a context manager. In this example, the context manager opens the file hello.txt and manages the file resource as long as the context is active. In general, all the code in the indented block […]

Read more

Combining Data in Pandas With merge(), .join(), and concat()

The Series and DataFrame objects in pandas are powerful tools for exploring and analyzing data. Part of their power comes from a multifaceted approach to combining separate datasets. With pandas, you can merge, join, and concatenate your datasets, allowing you to unify and better understand your data as you analyze it. In this tutorial, you’ll learn how and when to combine your data in pandas with: merge() for combining data on common columns or indices .join() for combining data on […]

Read more

Python 3.11 Preview: Task and Exception Groups

Python 3.11 will be released in October 2022. Even though October is still months away, you can already preview some of the upcoming features, including the new task and exception groups that Python 3.11 has to offer. Task groups let you organize your asynchronous code better, while exception groups can collect several errors happening at the same time and let you handle them in a straightforward manner. There are many other improvements and features coming in Python 3.11. Check out […]

Read more

Building a Django User Management System

If you’re building your own Django applications, you might decide to extend them with user accounts. In this video course, you’ll learn how to work with Django user management and add it to your program. By the end of this video course, you’ll be able to: Create an application where users can register, log in, and reset and change passwords on their own Edit the default Django templates responsible for user management Send password reset emails to actual email addresses […]

Read more

How to Get the Most Out of PyCon US

Congratulations! You’re going to PyCon US! Whether this is your first time or not, going to a conference full of people who love the same thing as you is always a fun experience. There’s so much more to PyCon than just a bunch of people talking about the Python language, and that can be intimidating for first-time attendees. This guide will help you navigate all there is to see and do at PyCon. PyCon US is the biggest conference centered […]

Read more

Python Virtual Environments: A Primer

In this tutorial, you’ll learn how to work with Python’s venv module to create and manage separate virtual environments for your Python projects. Each environment can use different versions of package dependencies and Python. After you’ve learned to work with virtual environments, you’ll know how to help other programmers reproduce your development setup, and you’ll make sure that your projects never cause dependency conflicts for one another. Virtual environments are a common and effective technique used in Python development. Gaining […]

Read more

Exploring Keywords in Python

Every programming language has special reserved words, or keywords, that have specific meanings and restrictions around how they should be used. Python is no different. Python keywords are the fundamental building blocks of any Python program. In this video course, you’ll find a basic introduction to all Python keywords along with other resources that will be helpful for learning more about each keyword. By the end of this video course, you’ll be able to: Identify Python keywords Understand what each […]

Read more

Python News: What’s New From March 2022?

In March 2022, the Python 3.11.0a6 pre-release version became available for you to test, so you can stay on top of Python’s latest features. This release is the sixth of seven planned alpha releases before Python enters the beta phase, which is scheduled for May 5, 2022. PEPs now have a new home with a sleek, modern theme. Also, PEP 594, which deals with removing dead batteries from the Python standard library, has been accepted. Regarding Python events, EuroPython 2022 […]

Read more

Speeding up software with faster hardware: tradeoffs and alternatives

If you’re writing software to process data, you will often hit performance problems: batch jobs that run too slowly, or use too much memory. One potential solution is purchasing better hardware. With cloud computing, switching to a computer with more cores, or adding more RAM, can be done in a few minutes, or even just a few seconds. But as with any solution, there are tradeoffs involved. If your first solution to any performance problem is spending more money on […]

Read more
1 96 97 98 99 100 185