The program I'm writing manipulates integers by applying binary operations to them (e.g. >>, &, |). Many of the operations are applied inside functions, and to make the results of the operations persist once the function returns, I'm returning a copy of the altered variable.
Something like:
updated = applyOp(original, amnt)
def applyOp(original, amnt):
return original >> amnt
If I didn't want to return a copy of the integer and instead wanted the changes made to original within the function to persist outside of the function, I suppose I could create a wrapper class of some kind. Are there other options? Perhaps ones that specifically facilitate bit wise integer manipulation?