Rust for Python Developers - Operators

Shin_O
58.8K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

This article was originally published on Medium

Follow me:

Compound Assignment Operators

All the Rust and Python compound assignment operators have the same symbols except Rust doesn’t have the equivalence of power assignment **=, and floor division assignment //=.

MeaningPythonRust
Arithmetic addition and assignment+=+=
Arithmetic subtraction and assignment-=-=
Arithmetic multiplication and assignment*=*=
Arithmetic division and assignment/=/=
Arithmetic remainder and assignment%=%=
Bitwise AND and assignment&=&=
Bitwise OR and assignment|=|=
Bitwise exclusive OR and assignment^=^=
Left-shift and assignmen<<=<<=
Right-shift and assignment>>=>>=
Arithmetic power assignment**=None
Arithmetic floor division assignment//=None
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content