In Java, if I want to increase a variable A, and set B equal to C, I can do it one statement as follows:
B = C + A - A++;
Python, unfortunately, does not support assignment within literals. What is the best way to mimic this kind of behavior within the language of Python? (with the intention of writing code in as few statements as possible)
Let me set something straight: I am not interested in writing code that is readable. I am interested in writing code with as few statements as possible.
One trivial example of one case where this would work would be to write a class
that holds an int
and has methods such as plus_equals
, increment
, etc.