Tuesday, February 23, 2010

Pointers in python

Hello guys , here is a small note on pointers in python . For all those unfamiliar with python , it is a interpreted , scripting , object - oriented and high level programming language , developed on C.

POINTER CONCEPT IN PYTHON:

Python , adopts a model , which is to be precise , very similar to java , ie all references , to objects are treated as pointers , but with very limited functionality over their addresses.

The following points , will clarify the concept presented above:

1) All objects in python , are references to memory locations and an assignment , such as a=b, assigns a reference of location of b to a.
But , in python , there is no explicit pointer arithmetic , very similar to java. The operations on the references , are well bound by the address of the pointed location of memory.

2) In python parameters , passed to functions , very similar to the assignment statement mentioned before.

3) In python , primitive types ,such as (int,str,tuple), are treated as immutable , such that their memory locations , cannot be modified , by accidental references.

Posted By:
Jayanthi GM(Course Instructor , Java ,PESIT)
Prashanth Raghu (Student Assistant)

No comments:

Post a Comment