Reputation: 125
I checked the operator precedence in Python 3, and found that there is no assignment (=
).
I want to know if assignment is an operator or not. If not, why are there so many "assignment operator" hits when Googled? What is the precedence relation with other real operators (bool operator, comparison operator, etc.)?
Upvotes: 3
Views: 327
Reputation: 599490
No. An assignment is always a statement in Python.
That's why things like assignment within if statements, which is acceptable in some other languages, is forbidden in Python.
Upvotes: 6