About 50 results
Open links in new tab
  1. What does colon equal (:=) in Python mean? - Stack Overflow

    158 This symbol := is an assignment operator in Python (mostly called as the Walrus Operator). In a nutshell, the walrus operator compresses our code to make it a little shorter. Here's a very simple …

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

    117 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 …

  3. operators - What does ":=" do? - Stack Overflow

    Mar 17, 2011 · 3 In Python: Named Expressions (NAME := expr) was introduced in Python 3.8. It allows for the assignment of variables within an expression that is currently being evaluated. The colon …

  4. coding style - Assignment with "or" in python - Stack Overflow

    Jan 6, 2012 · Is it considered bad style to assign values to variables like this? x = "foobar" or None y = some_variable or None In the above example, x gets the value 'foobar'.

  5. python - The differences' between the operator "==" and "=" - Stack ...

    In python and other languages like C, "=" is a assignment operator and is used to assign a value to a variable. Example: a=2 # the value of a is 2 whereas "==" is Comparison operator and is used to …

  6. python - How can I do assignments in a list comprehension ... - Stack ...

    Apr 24, 2012 · Python 3.8 will introduce Assignment Expressions. It is a new symbol: := that allows assignment in (among other things) comprehensions. This new operator is also known as the walrus …

  7. What do the symbols "=" and "==" mean in python? When is each used?

    Nov 11, 2025 · 3 The simple answer is = is an assignment operator, == is a comparison operator. And you are wrong in saying that == can be used in any situation when = works. For example if I wanted …

  8. Conditional/ternary operator for expressions in Python

    Many languages have a conditional (AKA ternary) operator. This allows you to make terse choices between two values based on a condition, which makes expressions, including assignments, …

  9. python - One line if-condition-assignment - Stack Overflow

    Oct 24, 2011 · One line if-condition-assignment Asked 14 years, 3 months ago Modified 4 months ago Viewed 537k times

  10. Is it possible to overload Python assignment? - Stack Overflow

    Jun 14, 2012 · 101 The way you describe it is absolutely not possible. Assignment to a name is a fundamental feature of Python and no hooks have been provided to change its behavior. However, …