Passing the member variable as an argument to the member vs. function some other alternative [C++ & Python]


In a Python class, let's say it's called some_class I've written, it contains a member function some_function (self, u) that leads in some argument you. This class also contains a member variable you.

I use this function in two ways:

some_class_instance.some_function (self.u)

Y

someClassInstance.some_function (u)

The first one takes its own member variable, but the second one does not.
This function MUST take some argument you, and in most circumstances, it is not the class instance you.

So currently, I just step on the instance of the class you as an argument if that is what needs to be taken, but I suspect that it is inefficient in terms of complexity, since it is making an unnecessary copy of that you in some_function, when the variable you It is already stored as a member variable in this case.

I'm looking for a more optimal way to do this. What I can think of is simply specifying you as an optional argument and then in the body of some_function, specify that if the you the argument is missing, then we use yo.u, and if there is no lack, we use what happens. This does not seem very elegant but it is more efficient. Is there a better way to do this?

I also have the same question for C ++, since sometimes I run into this problem in C ++. Would the same suggestions apply to C ++?