
Jan. 23, 2022
9:57 a.m.
https://docs.python.org/3/library/operator.html says "operator.add ... Return a + b, for *a* and *b* numbers " and "operator.mul... Return a * b, for *a* and *b* numbers" but both of those also work on strings [0] (and perhaps other types):
import operator operator.add('s', 't') 'st' operator.mul('a', 3) 'aaa' operator.mul(3, 'b') 'bbb'
[0] "Strings can be concatenated (glued together) with the + operator, and repeated with *"
3 * 'un' + 'ium''unununium'
https://docs.python.org/3/tutorial/introduction.html#strings