Python Pointers - revealed

There is a requirement to paint your office building. Hence you search for an company online to do this task for you (custom_function). The company initial requirement is to ship the office building to them and after completing the task of painting the building will be ship back to you. This might seems an heavy task and company deny to do it. As shipping back entire office building is cost heavy. Hence you decided to copy the address of the building (pointers) on an envelope and send it to the paint company. The company goes to the address and do the necessary work , in this way they has nothing to return back to you.

Objects in Python

Immutable vs Mutable Objects

Understanding Variables

Variables in C

int x = 2337;
x = 2338;

Names in Python:

>>> x = 2337
>>> x = 2338

Intern Objects in Python

Simulating Pointers in Python

>>> counters = {"func_calls": 0}
>>> def bar():
... counters["func_calls"] += 1
...
>>> def foo():
... counters["func_calls"] += 1
... bar()
...
>>> foo()
>>> counters["func_calls"]
2

Conclusion

Software Developer during day time, blogger at night.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store