What's Lazy Evaluation in Python?
Real Python
by Real Python
6h ago
Being lazy is not always a bad thing. Every line of code you write has at least one expression that Python needs to evaluate. Python lazy evaluation is when Python takes the lazy option and delays working out the value returned by an expression until that value is needed. An expression in Python is a unit of code that evaluates to a value. Examples of expressions include object names, function calls, expressions with arithmetic operators, literals that create built-in object types such as lists, and more. However, not all statements are expressions. For example, if statements and for loop sta ..read more
Visit website
Python Basics Exercises: Scopes
Real Python
by Real Python
6h ago
On your Python journey, you’ve worked with functions and loops. To fully understand functions and loops in Python, you need to be familiar with the issue of scope. In this Python Basics Exercises video course, you’ll practice: Identifying the scope of objects Working with the global keyword Exploring the LEGB rule for scope resolution Using the return statement in a function Scope can be one of the more difficult programming concepts to understand, so in this video course, you’ll get additional practice working with it. This video course is part of the Python Basics series, which accompanies ..read more
Visit website
Python Sequences: A Comprehensive Guide
Real Python
by Real Python
6h ago
In this quiz, you’ll test your understanding of Python sequences. By working through this quiz, you’ll revisit the basic characteristics of a sequence, operations common to most sequences, special methods associated with sequences, and how to create user-defined mutable and immutable sequences. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ..read more
Visit website
What's Lazy Evaluation in Python?
Real Python
by Real Python
6h ago
Lazy evaluation is a programming concept where the evaluation of an expression is deferred until its value is actually needed. This can lead to performance enhancements by avoiding unnecessary calculations, and it can also allow for the creation of potentially infinite data structures. As you embark on this quiz, you’ll test your knowledge of lazy evaluation in Python and learn how to apply this concept to write cleaner and more efficient code. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here t ..read more
Visit website
Write Unit Tests for Your Python Code With ChatGPT
Real Python
by Real Python
3d ago
Having a good battery of tests for your code may be a requirement for many Python projects. In practice, writing unit tests is hard and can take a lot of time and effort. Therefore, some developers don’t like to write them. However, with large language models (LLMs) and tools like ChatGPT, you can quickly create robust and complete sets of tests for your Python code. In Python, you can use multiple different tools for writing tests. The most commonly used tools include doctest, unittest, and pytest. ChatGPT can be of great help in writing tests with any of these tools. In this tutorial, you’l ..read more
Visit website
Python's unittest: Writing Unit Tests for Your Code
Real Python
by Real Python
5d ago
In this quiz, you’ll test your understanding of testing your Python code with the unittest framework. Testing in Python is a huge topic and can come with a lot of complexity, but it doesn’t need to be hard. You can create simple tests for your application in a few easy steps and then build on them from there. With this quiz, you can check your understanding of testing with Python’s unittest framework. Good luck! [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ..read more
Visit website
The Real Python Podcast – Episode #201: Decoupling Systems to Get Closer to the Data
Real Python
by Real Python
5d ago
What are the benefits of using a decoupled data processing system? How do you write reusable queries for a variety of backend data platforms? This week on the show, Phillip Cloud, the lead maintainer of Ibis, will discuss this portable Python dataframe library. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ..read more
Visit website
Write Pythonic and Clean Code With namedtuple
Real Python
by Real Python
5d ago
In this quiz, you’ll test your understanding of Python’s namedtuple(). By working through this quiz, you’ll revisit how to create namedtuple classes, identify and take advantage of the cool features of namedtuple, use namedtuple instances to write Pythonic code, and decide when to use a namedtuple over a similar data structure. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ..read more
Visit website
Format Floats Within F-Strings
Real Python
by Real Python
5d ago
In this quiz, you’ll test your understanding of How to Format Floats Within F-Strings in Python. You’ll often need to format and round a Python float to display the results of your calculations neatly within strings. While there are several ways to format numbers in Python, formatted string literals or f-strings are usually the most frequent choice in modern Python programs. Knowing how to use f-strings effectively can make your code more readable and concise. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox every couple of days. > ..read more
Visit website
Build Command-Line Interfaces With Python's argparse
Real Python
by Real Python
5d ago
In this quiz, you’ll test your understanding of Creating Command-line Interfaces in Python with argparse. Command-line apps may not be common in the general user’s space, but they’re present in development, data science, systems administration, and many other operations. Every command-line app needs a user-friendly command-line interface (CLI) so that you can interact with the app itself. In Python, you can create full-featured CLIs with the argparse module from the standard library. [ Improve Your Python With ? Python Tricks ? – Get a short & sweet Python Trick delivered to your inbox eve ..read more
Visit website

Follow Real Python on FeedSpot

Continue with Google
Continue with Apple
OR