Excel gives you a huge toolbox of functions ( SUM, IF, VLOOKUP, INDEX, etc.), but eventually, you hit a wall. Maybe you want to do something more custom than Excel allows. Maybe your file slows down with too many rows. Or maybe there simply isn't a built-in function for exactly what you need. Python solves this by letting you build your own custom functions. That's why it's so powerful for data analysis-it's Excel without limits.
These terms included affirming the statement that we 'do not, and will not during the term of this financial assistance award, operate any programs that advance or promote DEI [diversity, equity, and inclusion], or discriminatory equity ideology in violation of Federal anti-discrimination laws,' Crary noted.
Every October, I do a maintenance pass on all my projects. At a minimum, that involves dropping support for whatever Python version is no longer supported and adding support for the most recently released Python version. While doing that, I go through the issue tracker, answer questions, and fix whatever I can fix. Then I release new versions. Then I think about which projects I should deprecate and figure out a deprecation plan for them.
Here's the task. I want to create a class to represent a track and field event held in a competition. This entry allows you to enter the raw results as reported by the officials-the athlete's bib number and the time they clocked in a race. It then computes the event's full results. There's more we could add to make this class more complete. But I won't. You can create a list of athletes that are competing in the track and field meeting:
How well do you know the different areas where Python shines? In this quiz, you'll revisit web apps and APIs, GUI apps, CLI tools, machine learning, and more. You'll also check what Python isn't suited for and which alternatives work better. Get ready to explore the wide scope of what you can do with Python.
Everything in Python is an object, or so the saying goes. If you want to create your own custom objects, with their own properties and methods, you use Python's class object to do it. But creating classes in Python sometimes means writing loads of repetitive, boilerplate code; for example, to set up the class instance from the parameters passed to it or to create common functions like comparison operators.
If you spend long enough in the programming world, you'll come across the term singleton at some point. And if you hadn't seen this term yet, well, now you have! In Python, you don't need singleton classes. Almost never. But creating one is a great exercise in understanding how Python creates objects. And discussing alternatives to a singleton class helps you explore other aspects of Python.
What's changed about learning Python over the last few years? What new techniques and updated advice should beginners have as they start their journey? This week on the show, Stephen Gruppetta and Martin Breuss return to discuss beginning to learn Python. We share techniques for finding motivation, building projects, and learning the fundamentals. We provide advice on installing Python and not obsessing over finding the perfect editor. We also examine incorporating LLMs into learning to code and practicing asking good questions.
Let's say we have some text that was retrieved from a database, and the original text came from a form submission in a web browser. Web browsers often represent line breaks as a carriage return character, followed by a line feed character: That's what we see in our text as well: \r followed by \n. This is often called CRLF (carriage return and line feed) whereas \n is called LF (line feed).
Back then, constructing decorators using function closures had various short comings and the resulting wrappers didn't preserve introspection and various other attributes associated with the wrapped function. Many of these issues have been resolved in updates to Python and the functools.wraps helper function, but wrapt based decorators were still useful for certain use cases such as being able to create a decorator where you could work out whether it was applied to a function, instance method, class method or even a class.
This quiz helps you practice sorting dictionaries by keys, values, and custom rules in modern Python. You'll revisit how insertion order works, when to use different views, and how to rebuild sorted dictionaries. You'll also learn best practices for sorting dictionaries efficiently. For a complete overview, check out Sorting Dictionaries: Keys, Values, and More. The quiz contains 11 questions and there is no time limit. You'll get 1 point for each correct answer.
At the end of August, Python: The Documentary premiered on YouTube, where you can watch it for free. It's an 84-minute film tracing Python's journey from Amsterdam side project to the world's most popular programming language: Produced by CultRepo (formerly Honeypot) and directed by Ida Bechtle, the documentary explores Python's evolution and the community that shaped it. It features Guido van Rossum and key contributors like Mariatta and recent Real Python Podcast guest, Travis Oliphant. The documentary also highlights the important role of PyLadies and addresses controversial topics including the Python 2 to 3 transition.
When writing tests in pytest, often there's a need to set environment variables for your tests. Instead of modifying `os.environ` directly, which can lead to side effects and make tests harder to manage, here's how to do it with the [pytest-env](https://pypi.org/project/pytest-env/) package. First, install the package. ```sh pip install pytest-env # classic but works great uv add pytest-env # if you're one of us cool kids using uv uv add pytest-env --group test # if you use a specific test group of dependencies ```
Ready to level up your Python code optimization skills? In this quiz, you'll revisit key concepts about profiling, benchmarking, and diagnosing performance bottlenecks. You'll practice with tools like cProfile and timeit, and see how deterministic and statistical profilers differ.
Here's how [he demonstrated](https://adamj.eu/tech/2025/07/30/python-check-package-version-importlib-metadata-version/) I should be doing it instead. ```toml # pyproject.toml [project] name = "air" version = "0.25.0" # This is the source of truth for the version number ```
The termncolor package and its malicious dependency colorinal highlight the increasing sophistication of attacks targeting software repositories, enabling attackers to achieve remote code execution and system persistence.
When tackling object-oriented programming problems, one must choose between inheritance and composition, as each has distinct trade-offs. Composition often leads to more flexible and reusable code.