Why x+=1 doesn't return x value instead of an object

Siddhharth Choudhary siddharth654choudhary at gmail.com
Fri Oct 30 22:04:43 EDT 2020


I want to know why x+=1 does not return the value of the variable. It would be great if It has returned the value of the variable instead of an object. It will increase the beauty of python.
For instance,
              x = 5
              x+=1
              print(x)   = 6
If x+=1 had returned the value instead of object
              x = 5
              print(x+=1)   = 6
which is not possible?


More information about the Python-list mailing list