Premise:
Suppose I have a variable x
and two function f(x)
and g(x)
such that when f(x)
has the ability to change the value of x
(maybe it wants to keep track on how many times f(x)
has been called) and g(x)
doesn't want to change the value of x at any cost.
Now if i was choose x
as an integer, I can accomplish g(x)
and if x
is a list, I can accomplish f(x)
.
Question:
But what if I want to accomplish both of them in the same program?
What should I do then?.
If its not possible, then doesn't this severely handicap python wrt other languages.
Note:
Basically my question is motivated by finding the drawbacks of not having pointers in python as in other language like C++, the above task can easily be implemented by choosing the *x
instead of x
.