Pointers vs garbage collection in Python
<p>I understand in Python that assigning a name to an object creates a reference to the object, and that when an objects' ref count goes to zero it is garbage collected. I want to understand whether I should be using pointers in my code or if allowing regular garbage collection is better.</p>

<pre><code>import time

while True:
    foo = time.clock() #every iteration get the clock time
</code></pre>

<p>In my code above, every iteration of the loop assigns the variable name "foo" to reference a new float object returned from time.clock(). Since I know that "foo" will always make reference to a float object returned from time.clock() is it more efficient to use a pointer? (e.g. from ctypes module)? If this were C I would use a pointer but in Python I'm not sure if it matters.</p>

<p>There is no notion of pointer in pure Python. What you are referring to is the <code>ctypes</code> module, it is meant to interact with code actually written and compiled in a C compatible language (where pointers actually exist).</p>

<p>So your question is invalid.</p>

python pointers garbage-collection ctypes