java 

Python Community Interview With Brett Slatkin

Today I’m speaking to Brett Slatkin, a principal software engineer at Google and the author of the Python programming book Effective Python. Join us as we discuss Brett’s experience working with Python at Google, refactoring, and the challenges he faced when writing the second edition of his book. Without any further ado, let’s get into it! Ricky: Welcome to Real Python, Brett. I’m glad you could join me for this interview. Let’s start the same way we do with all our guests. How’d you get into programming, and when did…

Read More

Python Regex Methods – A Short Overview

Python’s re module comes with a number of regular expression methods that help you achieve more with less. Think of those methods as the framework connecting regular expressions with the Python programming language. Every programming language comes with its own way of handling regular expressions. For example, the Perl programming language has many built-in mechanisms for regular expressions—you don’t need to import a regular expression library—while the Java programming language provides regular expressions only within a library. This is also the approach of Python.  These are the most important regular…

Read More

The NSA Has a Beginner Python Course

The National Security Agency (NSA) recently released a free Python programming course for beginners after a Freedom of Information Act (FOIA) request according to ZDNet. There is almost 400 pages of material that has been uploaded to Digital Oceans Spaces by Chris Swenson, the software developer who made the original request. You can access the course PDF directly here. Interestingly, the document mentions a couple of No Starch Press’s most popular books, such as “Automate the Boring Stuff with Python” and “Python Crash Course”. The document is a bit dry,…

Read More
Programming 

PyCoder’s Weekly: Issue #407 (Feb. 11, 2020)

#407 – FEBRUARY 11, 2020 View in Browser » Understanding Best-Practice Python Tooling by Comparing Popular Project Templates “Use Flake8, pytest, and Sphinx in your current Python project. Also evaluate pre-commit, black, and Pylint. For your next project, consider adding poetry and Dependabot.” JONAS KEMPER Playing and Recording Sound in Python Learn about libraries that can be used for playing and recording sound in Python, such as PyAudio and python-sounddevice. You’ll also see code snippets for playing and recording sound files and arrays, as well as for converting between different…

Read More
java 

Implementing an Interface in Python

Interfaces play an important role in software engineering. As an application grows, updates and changes to the code base become more difficult to manage. More often than not, you wind up having classes that look very similar but are unrelated, which can lead to some confusion. In this tutorial, you’ll see how you can use a Python interface to help determine what class you should use to tackle the current problem. In this tutorial, you’ll be able to: Understand how interfaces work and the caveats of Python interface creation Comprehend…

Read More
css 

Python cProfile – 7 Strategies to Speed Up Your App

Your Python app is slow? It’s time for a speed booster! Learn how in this tutorial. As you read through the article, feel free to watch the explainer video: Performance Tuning Concepts 101 I could have started this tutorial with a list of tools you can use to speed up your app. But I feel that this would create more harm than good because you’d spend a lot of time setting up the tools and very little time optimizing your performance. Instead, I’ll take a different approach addressing the critical…

Read More
java 

PyDev of the Week: Paul Sokolovsky

This week we welcome Paul Sokolovsky as our PyDev of the Week! Paul is the creator of Pycopy, which is described as “a minimalist and memory-efficient Python implementation for constrained systems, microcontrollers, and just everything”. You can check out more of his contributions to open source on Github. Let’s take a few moments to get to know Paul better! Can you tell us a little about yourself (hobbies, education, etc): I have Computer Science as my first masters, and later got another masters in Linguistics – when I was a…

Read More
Programming 

Python cProfile – A Helpful Guide with Prime Example

Python comes with different profilers. If you’re new to performance optimization, you may ask: what’s a profiler anyway? A performance profiler allows you to monitor your application more closely. If you just run a Python script in your shell, you see nothing but the output produced by your program. But you don’t see how much bytes were consumed by your program. You don’t see how long each function runs. You don’t see the data structures that caused most memory overhead. Without those things, you cannot know what’s the bottleneck of…

Read More

Stack Abuse: Formatting Strings with the Python Template Class

Introduction Python Templates are used to substitute data into strings. With Templates, we gain a heavily customizable interface for string substitution (or string interpolation). Python already offers many ways to substitute strings, including the recently introduced f-Strings. While it is less common to substitute strings with Templates, its power lies in how we can customize our string formatting rules. In this article, we’ll format strings with Python’s Template class. We’ll then have a look at how we can change the way our Templates can substitute data into strings. For a…

Read More