• Python Home
  • Documentation
  • Developer's Guide
  • Random Issue
  • Issues with patch
  • Easy issues

Google

  • Lost your login?
  • Committer List
  • Tracker Documentation
  • Tracker Development
  • Report Tracker Problem

syntaxerror lambda cannot contain assignment

This issue tracker has been migrated to GitHub , and is currently read-only . For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/33922

Created on 2001-02-14 08:45 by anonymous , last changed 2022-04-10 16:03 by admin . This issue is now closed .

Python Forum

  • View Active Threads
  • View Today's Posts
  • View New Posts
  • My Discussions
  • Unanswered Posts
  • Unread Posts
  • Active Threads
  • Mark all forums read
  • Member List
  • Interpreter

How do I make an assignment inside lambda function?

  • Python Forum
  • Python Coding
  • General Coding Help
  • 0 Vote(s) - 0 Average
  • View a Printable Version

User Panel Messages

Announcements.

syntaxerror lambda cannot contain assignment

Login to Python Forum

Python for Programmers: Lambda Expressions

Welcome to the Lambda Expressions lesson!

This lesson is shown as static text below. However, it's designed to be used interactively. Click the button below to start!

Some languages, most notably JavaScript, have function definitions that are also expressions. That lets us assign function definitions to variables. Here's some JavaScript code that defines a variable with const double and assigns a function to it:

We can't do that with Python's def because it's a statement, not an expression. The difference is that expressions have values, but statements don't. 1 + 1 , f(x) , and (name, email) are all expressions. if , for , and def are all statements. We can't say x = if ... , or x = def double(x): .

Trying to assign a def to a variable is a syntax error.

However, expression syntax for function definitions is useful, so Python has a way to do it: the lambda keyword. Lambdas allow us to define small, inline functions and assign them to variables.

Lambda functions can take arguments, just like regular def functions. The function below takes two arguments, x , and y .

While parentheses around arguments are required in def , they're not allowed at all in lambda . Adding parentheses causes a syntax error.

Also unlike def , lambda s don't need a return . That's because a lambda's body always contains exactly one expression: never two expressions, and never a statement. Because there's only one expression, Python knows that we must want to return it.

Because lambdas can only contain expressions, we can't use if , while , for , def , or assignments with = . All of those are statements. Trying to use any statement inside of a lambda function is a syntax error.

Lambdas are "anonymous", meaning that they have no name. Contrast that with regular def functions, whose names are stored in the __name__ property.

In the next example, we define two regular functions with def . We pass one function as an argument to the other function.

We can rewrite that as a pair of lambda functions.

We can even inline both function definitions, giving us a single line of code. In the next example, the two lambda functions are exactly the same as above.

You probably won't ever write that line of code, since it's the same as writing 6 . But it does show how compact lambdas can be.

Here's a more common, real-world example of how lambda s are used. Lists have a .sort method that we saw briefly in another lesson. It sorts numbers from smallest to largest, and it sorts strings alphanumerically (from "a" to "z".)

Sometimes we want more control over how a list is sorted. For example, we might want to sort strings by their lengths, rather than by their alphanumeric values.

The .sort method takes an optional key argument for exactly this purpose. It calls the key function on each list element, then sorts the list elements according to those sort keys. This is a perfect use case for a lambda !

The key function can be any function, whether it was defined with def or lambda . However, key functions are often short, making lambda a good choice.

Finally, you might wonder why these are called "lambda" functions.

In the 1930s, Alonzo Church used the Greek letter λ (lambda) in what we now call "the lambda calculus", a formal system critical to the early history of computing. For example, the "identity function", a function that returns its argument, is written as λx. x .

The Python lambda syntax is directly descended from Alonzo Church's work, even though a century has passed: lambda x: x . The x s are the same, the λ becomes the word lambda written out, and the . becomes a : . And note that λx. x doesn't have a name, just like lambda x: x doesn't have a name.

  • Trending Categories

Data Structure

  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary

Why can’t Python lambda expressions contain statements?

Yes, Python Lambda Expressions cannot contain statements. Before deep diving the reason, let us understand what is a Lambda, its expressions, and statements.

The Lambda expressions allow defining anonymous functions. A lambda function is an anonymous function i.e. a function without a name. Let us see the syntax −

The keyword lambda defines a lambda function. A lambda expression contains one or more arguments, but it can have only one expression.

Lambda Example

Let us see an example −

Sort a List by values from another list using Lambda

In this example, we will sort a list by values from another list i.e. the 2nd list will have the index in the order in which they are placed in sorted order −

Lambda Expressions cannot contain statements

We have seen two examples above wherein we have used Lambda expressions. Python lambda expressions cannot contain statements because Python’s syntactic framework can’t handle statements nested inside expressions.

Functions are already first-class objects in Python, and can be declared in a local scope. Therefore, the only advantage of using a lambda instead of a locally defined function is that you don’t need to invent a name for the function i.e. anonymous, but that’s just a local variable to which the function object is assigned!

AmitDiwan

Related Articles

  • Why we use lambda expressions in Java?
  • Lambda Expressions in C#
  • What are lambda expressions in C#?
  • Generalized Lambda Expressions in C++14
  • Are lambda expressions objects in Java?
  • Concurrent Programming Approach using Lambda Expressions
  • Why can’t raw strings (r-strings) end with a backslash in Python?
  • What are block lambda expressions in Java?
  • How to debug lambda expressions in Java?
  • Why can’t we override static methods in Java?
  • Differences between Lambda Expressions and Closures in Java?
  • Like plants why humans can’t prepare their own food?
  • Java Program to initialize a HashMap with Lambda Expressions
  • What are the characteristics of lambda expressions in Java?
  • How to implement the listeners using lambda expressions in Java?

Kickstart Your Career

Get certified by completing the course

  • SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?

avatar

Last updated: Feb 17, 2023 Reading time · 6 min

banner

# Table of Contents

  • SyntaxError: cannot assign to literal here (Python)
Note: If you got the error: "SyntaxError: cannot assign to literal here" , click on the second subheading.

# SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?

The Python "SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?" occurs when we have an expression on the left-hand side of an assignment.

To solve the error, specify the variable name on the left and the expression on the right-hand side.

syntaxerror cannot assign to expression here

Here is an example of how the error occurs.

hyphen in the name of the variable

# Don't use hyphens in variable names

If this is how you got the error, use an underscore instead of a hyphen.

dont use hyphens in variable names

The name of a variable must start with a letter or an underscore.

A variable name can contain alpha-numeric characters ( a-z , A-Z , 0-9 ) and underscores _ .

Variable names cannot contain any other characters than the aforementioned.

# Don't use expressions on the left-hand side of an assignment

Here is another example of how the error occurs.

We have an expression on the left-hand side which is not allowed.

The variable name has to be specified on the left-hand side, and the expression on the right-hand side.

use expression on right hand side

Now that the division is moved to the right-hand side, the error is resolved.

# Use double equals (==) when comparing values

If you mean to compare two values, use the double equals (==) sign.

use double equals when comparing values

Notice that we use double equals == when comparing two values and a single equal = sign for assignment.

Double equals (==) is used for comparison and single equals (=) is used for assignment.

If you use a single equals (=) sign when comparing values, the error is raised.

# Declaring a dictionary

If you got the error when declaring a variable that stores a dictionary, use the following syntax.

Notice that each key and value are separated by a colon and each key-value pair is separated by a comma.

The error is sometimes raised if you have a missing comma between the key-value pairs of a dictionary.

# SyntaxError: cannot assign to literal here (Python)

The Python "SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?" occurs when we try to assign to a literal (e.g. a string or a number).

To solve the error, specify the variable name on the left and the value on the right-hand side of the assignment.

syntaxerror cannot assign to literal here

Here are 2 examples of how the error occurs.

value on left hand side of assignment

Literal values are strings, integers, booleans and floating-point numbers.

# Variable names on the left and values on the right-hand side

When declaring a variable make sure the variable name is on the left-hand side and the value is on the right-hand side of the assignment ( = ).

variable names on left and values on right hand side

Notice that variable names should be wrapped in quotes as that is a string literal.

The string "name" is always going to be equal to the string "name" , and the number 100 is always going to be equal to the number 100 , so we cannot assign a value to a literal.

# A variable is a container that stores a specific value

You can think of a variable as a container that stores a specific value.

Variable names should not be wrapped in quotes.

# Declaring multiple variables on the same line

If you got the error while declaring multiple variables on the same line, use the following syntax.

The variable names are still on the left, and the values are on the right-hand side.

You can also use a semicolon to declare multiple variables on the same line.

However, this is uncommon and unnecessary.

# Performing an equality comparison

If you meant to perform an equality comparison, use double equals.

We use double equals == for comparison and single equals = for assignment.

If you need to check if a value is less than or equal to another, use <= .

Similarly, if you need to check if a value is greater than or equal to another, use >= operator.

Make sure you don't use a single equals = sign to compare values because single equals = is used for assignment and not for comparison.

# Assigning to a literal in a for loop

The error also occurs if you try to assign a value to a literal in a for loop by mistake.

Notice that we wrapped the item variable in quotes which makes it a string literal.

Instead, remove the quotes to declare the variable correctly.

Now we declared an item variable that gets set to the current list item on each iteration.

# Using a dictionary

If you meant to declare a dictionary, use curly braces.

A dictionary is a mapping of key-value pairs.

You can use square brackets if you need to add a key-value pair to a dictionary.

If you need to iterate over a dictionary, use a for loop with dict.items() .

The dict.items method returns a new view of the dictionary's items ((key, value) pairs).

# Valid variable names in Python

Note that variable names cannot start with numbers or be wrapped in quotes.

Variable names in Python are case-sensitive.

The 2 variables in the example are completely different and are stored in different locations in memory.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

  • SyntaxError: cannot assign to function call here in Python

book cover

Borislav Hadzhiev

Web Developer

buy me a coffee

Copyright © 2024 Borislav Hadzhiev

Understanding and Avoiding Syntax Errors in Python Dictionaries

Python Dictionary Object SyntaxError Expression Cannot Contain Assignment, Perhaps You Meant ==

In Python, there are three main types of errors: Syntax errors, Runtime errors, and Logical errors. Syntax errors can include system errors and name errors. System errors occur when the interpreter encounters extraneous tabs and spaces, given that proper indentation is essential for separating blocks of code in Python. Name errors arise when variables are misspelled, and the interpreter can’t find the specified variable within the code’s scope.

Syntax errors are raised when the Python interpreter fails to understand the given commands by the programmer. In other words, when you make any spelling mistake or typos in your code, it will most definitely raise a syntax error.

It can also be raised when defining data types. For example, if you miss the last curly bracket, “}” when defining a dictionary or capitalize the “P” while trying to print an output, it will inevitably raise a syntax error or an exception.

In this article, we will take a look at one of the most common syntax errors. When trying to define dictionaries, there shouldn’t be any assignment operator, i.e., “=” between keys and values. Instead, you should put a colon , “:” between the two.

Let’s look at the root of the above problem followed by it’s solution.

Similar: Syntax Error: EOL while scanning string literal.

Causes of Syntax Errors in Python Dictionaries

Python’s syntax errors can happen for many reasons, like using tabs and spaces incorrectly, spelling variables wrong, using operators the wrong way, or declaring things incorrectly. One common mistake is defining dictionaries wrongly by using “=” instead of “:” between keys and values. Fixing these issues usually means double-checking that everything is spelled right and that you are using things like colons, semicolons, and underscores properly.

There can be numerous reasons why you might encounter a syntax error in python. Some of them are:

  • When a keyword is misspelled.
  • If there are missing parenthesis when using functions, print statements, or when colons are missing at the end of for or while loops and other characters such as missing underscores(__) from def __innit__() functions.
  • Wrong operators that might be present at the wrong place.
  • When the variable declared is wrong or misspelled.

Differentiating between ‘=’ and ‘==’ in context of Python Dictionaries

In Python and many other programming languages, the single equals sign “=” denotes assignment, where a variable is given a specific value. In contrast, the double equals sign “==” is used to check for equality between two values or variables.

For example, if there are two variables, namely. ‘a’ and ‘b’ in your code, and you want to assign the integer values of 10 and 20 to each, respectively. In this case, you’ll need to use the assignment operator, that is, a single equal to sign(=) in your code in the following way:

But instead, if we want to check whether the values assigned to ‘a’ and ‘b’ are equal using an “if” statement, we will use the double equal to sign (==) such as,

Syntax Rules for Python Dictionaries

In Python, dictionaries are a unique type of data-storing variables. They are ordered and mutable in nature unlike lists. They are assigned in pairs, in the form of keys and values. Each element in a dictionary is indexed by its’ keys. Each value is accessed by keeping track of its respective key. There should be a colon”:” separating the value from its respective key. They are represented by curly braces ‘{}’. Each key and value pair can be separated from one another with commas ‘,’.

They can be assigned in the following manner:

our_dictionary= {"key1": "value1", "key2":"value2", "key3":"value3",....}

Do check out: [SOLVED] ‘Unexpected Keyword Argument’ TypeError in Python .

Reproducing the Syntax Error: expression cannot contain assignment, perhaps you meant “==”?

In this case, the problem might arise when instead of using a colon “:”, the interpreter encounters an assignment operator. There is a built in function in Python that can explicitly convert data into dictionaries called dict(). But this function might also cause this problem when the identifier is wrong or when there are other syntax mistakes in the code, such as missing parenthesis at the end of a statement.

The error is shown below:

Reproducing The Error

Mitigating Syntax Errors in Python Dictionaries

The only straight forward solution to this problem is making sure you spell the keywords and in built functions correctly and remember to use the identifiers such as colons, semicolons and underscores properly.

Try to avoid using the dict() function for creating dictionaries. Instead, use curly braces as much as possible. If using the function is a necessity, make sure you don’t use the assignment operator incorrectly and use parentheses where necessary.

In the following code, there are no exceptions raised because the syntax is correct and the variable has been assigned correctly.

Nowadays, there are built in syntax detectors in IDEs and editors which can highlight syntax errors like this one. You can also use a debugger if necessary.

Key Takeaways: Avoiding Syntax Errors in Python Dictionaries

Having dived into the causes and solutions of Python’s syntax errors, we hope this equips you to write more efficient, error-free code. The intricacies of Python dictionaries need not be a source of worry. With the right practices, you can avoid these errors, optimizing your code and enriching your programming journey.

How will this knowledge influence your approach to using Python dictionaries in future projects?

Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for assignment #79350

@serhiy-storchaka

serhiy-storchaka commented Nov 5, 2018

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

GitHub fields:

bugs.python.org fields:

The text was updated successfully, but these errors were encountered:

Sorry, something went wrong.

@serhiy-storchaka

serhiy-storchaka commented Nov 18, 2018

Serhiy-storchaka commented nov 20, 2018.

@ezio-melotti

No branches or pull requests

@serhiy-storchaka

質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!.

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

lambda(無名関数)の使い方の確認

iBETA

投稿 2020/07/01 14:59

無名関数に使用されるlambda の使い方に関しての質問になります。

こう入力し実行すると SyntaxError: expression cannot contain assignment, perhaps you meant "=="? というエラーが出ます。

つまり、lambda関数のコロンの後には、実行する内容を書くというより リターンする内容しかかけないということでしょうか。。。 どうぞよろしくお願いします。

以下、VERSION になります。 Python: 3.8

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちら の条件を満たす必要があります。

guest

リターンする内容しかかけないということでしょうか。。。

lambda式には「式」しか書けません。式を評価した値が復帰値となります。 代入文やfor文などの「文」は書けません。

投稿 2020/07/01 15:04

shiracamus

2020/07/01 21:01

2020/07/02 01:07 編集

2020/07/03 03:29

質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。

15分調べてもわからないことは teratailで質問しよう!

ただいまの回答率 85 . 50 %

質問をまとめることで 思考を整理して素早く解決

テンプレート機能で 簡単に質問をまとめる

IMAGES

  1. C# : Expression cannot contain lambda expressions

    syntaxerror lambda cannot contain assignment

  2. Introduction a unique Insider: Python Lambda Function

    syntaxerror lambda cannot contain assignment

  3. Python SyntaxError: cannot assign to operator Solution

    syntaxerror lambda cannot contain assignment

  4. c#

    syntaxerror lambda cannot contain assignment

  5. SyntaxError: expression cannot contain assignment, perhaps you meant

    syntaxerror lambda cannot contain assignment

  6. Python SyntaxError: cannot assign to None

    syntaxerror lambda cannot contain assignment

VIDEO

  1. PART 10: SYNTAXERROR IN PYTHON PROGRAMMING

  2. A212 ISMP SENI Tugasan Kelarai. Motif Flora,Fauna dan Abstrak

  3. 2 3 شرح الاخطاء البرمجية

  4. types of error in python| #syntaxerror

  5. Syntax error 😂#coding #viralmemes #viralreels #trendingmemes #trendingmemes #syntaxerror #cpp #java

  6. SyntaxError: Unexpected token 😅 #programming #coding #errors #funny

COMMENTS

  1. Why are assignments not allowed in Python's `lambda` expressions?

    The entire reason lambda exists is that it's an expression. 1 If you want something that's like lambda but is a statement, that's just def.. Python expressions cannot contain statements. This is, in fact, fundamental to the language, and Python gets a lot of mileage out of that decision.

  2. Assignment inside lambda expression in Python

    The assignment expression operator := added in Python 3.8 supports assignment inside of lambda expressions. This operator can only appear within a parenthesized (...), bracketed [...], or braced {...} expression for syntactic reasons. For example, we will be able to write the following: import sys.

  3. error message confusing for assignment in lambda #33922

    SyntaxError: lambda cannot contain assignment. This triggers if and only if the LHS test bottoms out at a lambdef. Solves nothing in general, but is a one-liner change that catches this kind of case reliably, and hurts nothing else. If the flawed lambda is embedded in a larger expression, then this test won't trigger, but then "keyword can't be ...

  4. Issue 232313: error message confusing for assignment in lambda

    I put in a hack to make this produce: SyntaxError: lambda cannot contain assignment This triggers if and only if the LHS test bottoms out at a lambdef. Solves nothing in general, but is a one-liner change that catches this kind of case reliably, and hurts nothing else. If the flawed lambda is embedded in a larger expression, then this test won ...

  5. Python workarounds for assignment in lambda

    range(a)+range(b) r=range;r(a)+r(b) print s[1:],s[1:]*2. r=s[1:];print r,r*2. Other languages have workarounds, Octave for example. There are known tricks for Python, but they are long, clunky, and/or limited-use. A short, general-purpose method to simulate assignment in a lambda would revolutionize Python golfing.

  6. Assignment OR expressions fail on using lambda expressions #95788

    Sign in to comment. Bug report The case is where if a variable is None or False, we need to set it to another value; in this specific case, a lambda expression. The if statement: if b: a = b else: a = c can be shortened to: a = b or c and is common in many ...

  7. SyntaxError when using Keyword arguments with lambdas, but not ...

    Diapolo10. •. This is all happening because the assignment operator is always considered illegal syntax inside a lambda. Therefore, you have two options: Use a proper, named function. Circumvent the assignment limitation. The first one is fairly obvious, just by converting. x=Test (bibble=lambda _**: Test (wibble=1)) to.

  8. How do I make an assignment inside lambda function?

    Lambas in Python must be an expression. Assignments are statements. Things like return, break, continue, the equals sign, and that are all statements. While and for loops are also not expressions, although comprehensions are expressions. exec is also a statement, not a function (since functions can be used for expressions) and eval (), though a ...

  9. 13 Lambda Syntax [solved]

    The lambda should ensure that only "Python" is returned by the filter. Fill in the second part of the filter function with languages, the list to filter. 3 Likes

  10. Lambda Expressions Lesson

    The Python lambda syntax is directly descended from Alonzo Church's work, even though a century has passed: lambda x: x.The xs are the same, the λ becomes the word lambda written out, and the . becomes a :.And note that λx. x doesn't have a name, just like lambda x: x doesn't have a name.λx. x doesn't have a name, just like lambda x: x doesn't have a

  11. Why can't Python lambda expressions contain statements?

    Yes, Python Lambda Expressions cannot contain statements. Before deep diving the reason, let us understand what is a Lambda, its expressions, and statements. The Lambda expressions allow defining anonymous functions. A lambda function is an anonymous function i.e. a function without a name. Let us see the syntax −. The keyword lambda defines ...

  12. SyntaxError: cannot assign to expression here. Maybe you meant

    # SyntaxError: cannot assign to literal here (Python) The Python "SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?" occurs when we try to assign to a literal (e.g. a string or a number). To solve the error, specify the variable name on the left and the value on the right-hand side of the assignment.

  13. One-line lambda function that sets a value to a variable

    SyntaxError: lambda cannot contain assignment. python; variables; lambda; Share. Improve this question. Follow asked May 26, 2020 at 17:39. Basj Basj. 43.3k 107 107 gold badges 405 405 silver badges 721 721 bronze badges. 1. 1. setattr() should work. You can check its usage here - dstrants.

  14. Understanding and Avoiding Syntax Errors in Python Dictionaries

    Reproducing the Syntax Error: expression cannot contain assignment, perhaps you meant "=="? In this case, the problem might arise when instead of using a colon ":", the interpreter encounters an assignment operator. There is a built in function in Python that can explicitly convert data into dictionaries called dict().

  15. Use syntaxError in prospector With Examples

    pass 94 Traceback (most recent call last): 95 SyntaxError: assignment to None (<doctest test.test_syntax[19]>, ... 169 Traceback (most recent call last): 170 SyntaxError: lambda cannot contain assignment (<doctest test.test_syntax[27]>, line 1) 171 The grammar accepts any test (basically, any expression) in the 172 keyword slot of a call site.

  16. Python Dictionary Object: SyntaxError: expression cannot contain

    File "<stdin>", line 1 SyntaxError: expression cannot contain assignment, perhaps you meant "=="? Can someone tell me, why am I allowed to create dictionary with integer keys using Statement 1, but not with Statement 2? Edited Using an updated version of Statement 2, I am able to create dictionary object with below code:

  17. Improve error messages for assignment #79350

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  18. Lambda Function Cannot Be Assigned to Method

    1 Answer. Sorted by: 1. instead of modifying the Request object (which mypy is helpfully erroring on as generally an assignment to a function is a mistake or a monkeypatch hack) you can set the method directly in construction of Request: request = urllib.request.Request(request_url, serialized_body, headers=header, method='POST') this parameter ...

  19. lambda(無名関数)の使い方の確認

    こう入力し実行すると SyntaxError: expression cannot contain assignment, perhaps you meant "=="? というエラーが出ます。 つまり、lambda関数のコロンの後には、実行する内容を書くというより リターンする内容しかかけないということでしょうか。 どうぞよろしくお願いします。

  20. python

    22. Python is upset because you are attempting to assign a value to something that can't be assigned a value. ((t[1])/length) * t[1] += string. When you use an assignment operator, you assign the value of what is on the right to the variable or element on the left. In your case, there is no variable or element on the left, but instead an ...

  21. SyntaxError: expression cannot contain assignment, perhaps you meant

    Stack Overflow Public questions & answers; Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Talent Build your employer brand ; Advertising Reach developers & technologists worldwide; Labs The future of collective knowledge sharing; About the company