Hey Juan, I didn't actually submit this as PR to python. The language remains the same.
This post is just an fun experiment.
The code you suggest has the same result indeed but this example is just an illustration.
There are other use cases as well where this trick wouldn't work.
For example
>>> a = 'hello' * False
>>> type(a)
str
>>> a = 'hello' if False
>>> type(a)
NoneType
As you can see, your suggestion only work for integers, the "else-less" solves other problems as well.
I hope that answers your question and thanks for your comment!
Juan Francisco Roco
Congratulations... I read about this on PyCoder's Weekly
Isn't this enough for your use case (pure and simple Python)?
>>> 42 * True 42 >>> 21 * False 0 >>> a = 42 >>> a += 1 * False >>> a 42 >>> a += 1 * True >>> a 43