Operators
*= — Multiplication assignment
Scale a number or repeat a supported sequence. List repetition updates the same outer list and duplicates references, not nested objects. For mutable sequences, a nonpositive integer repetition count clears the sequence. The __imul__() hook may modify its receiver or supply a replacement. If absent or declining with NotImplemented, normal binary dispatch applies. The result is stored back into the target; this is a statement, not an expression. A failed store does not guarantee rollback.
Formal Syntax & Structure
python syntaxpython
target *= expressionParameters & Attributes
| Name | Type | Description |
|---|---|---|
| target | object | Existing assignable name, attribute, item or slice; its current value participates in the operation. |
| right | number or integer-like repeat count | Value used as the right operand of the operation. |
Working Example
Example Snippetpython
price = 8price *= 3rows = [[]]alias = rowsrows *= 2rows[0].append(5)print(price)print(alias)