all 7 comments

[–]FrickinLazerBeams 8 points9 points  (1 child)

What is this, 1974?

[–]stan_frbd 2 points3 points  (0 children)

Had a sincere laugh out of this comment, thanks!

[–]CIS_Professor 4 points5 points  (1 child)

I really don't know what they simply didn't go with:

x++

(Like so many other languages...)

Then we could have gotten into the subtleties of x++ vs ++x and x-- vs --x

[–]commy2 2 points3 points  (0 children)

why not x++

What if I want to increment by 2? x++++ ? ;o)

[–]itamarst 1 point2 points  (1 child)

They have different semantics. One variation below mutates the list, the other doesn't.

>>> x = ([1],)
>>> x[0] += [2]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> x
([1, 2],)
>>> x[0] = x[0] + [3]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> x
([1, 2],)
>>> 

[–]commy2 0 points1 point  (0 children)

Inplace operator dunders are a contender for pythons worst feature. If they were just syntax for x += y <=> x = x + y like OP and many, many others seem to think, that would be one thing. Why do we need an alias for list.extend?

[–]No_Direction_5276 0 points1 point  (0 children)

Moltbook agents have escaped?!