About 167,000 results
Open links in new tab
  1. The Walrus Operator: Python's Assignment Expressions

    Dec 14, 2024 · Python’s walrus operator (:=) allows you to assign values to variables as part of an expression. It can simplify your code by combining assignment and evaluation in a single statement.

  2. Walrus Operator in Python 3.8 - GeeksforGeeks

    Mar 6, 2025 · In this article, we’re going to discuss the Walrus operator and explain it with an example. Walrus Operator allows you to assign a value to a variable within an expression. This can be useful when you need to use a value multiple times in …

  3. The Most Controversial Python Walrus Operator

    Jul 4, 2021 · In this article, we will go through what is python walrus operator, the controversy behind it, examples and when not to use the walrus operator

  4. python - What are assignment expressions (using the "walrus" or ...

    Since Python 3.8, code can use the so-called "walrus" operator (:=), documented in PEP 572, for assignment expressions. This seems like a really substantial new feature, since it allows this form of assignment within comprehensions and lambda s.

  5. Python's Walrus Operator: The Assignment Expression (Tutorial)

    Aug 28, 2024 · The assignment expression, which uses the := syntax and is often referred to as the walrus operator, is a relatively new addition to Python. The assignment statement, which uses the = operator, is the more common way of assigning a value to a variable name.

  6. Walrus Operator in Python: When to Use It? (with Examples)

    Feb 15, 2023 · Walrus Operator in Python allows you to assign values to variables as part of an expression. It was first made available in Python 3..8 and later. In layman's terms, it combines Python's Assignment and Equality operators in a single line of code.

  7. The Walrus Operator in Python | Towards Data Science

    Mar 5, 2021 · Introduced in python 3.8, the walrus operator, (:=), formally known as the assignment expression operator, offers a way to assign to variables within an expression, including variables that do not exist yet.

  8. Python Walrus Operator - Analytics Vidhya

    Jan 29, 2025 · Use Cases for Python’s Walrus Operator. The Walrus Operator (:=) is a versatile tool in Python that enables assignment within expressions. Below are detailed use cases where this operator shines, along with examples to illustrate its …

  9. Python walrus operator - using walrus operator in Python

    Jan 29, 2024 · Python walrus operator tutorial shows how to use walrus operator in Python. Python 3.8 introduced a new walrus operator :=. The name of the operator comes from the fact that is resembles eyes and tusks of a walrus of its side. The walrus operator creates an assignment expression.

  10. Python's walrus operator - Python Morsels

    Aug 16, 2021 · We're using the walrus operator, which is the thing that powers assignment expressions. Assignment expressions allow us to embed an assignment statement inside of another line of code. They use walrus operator (:=): Which is different from a plain assignment statement (=) because an assignment statement has to be on a line all on its own:

  11. Some results have been removed
Refresh