Python: default argument values vs global variables <p>I saw this default values usage in the Python's <a href="http://hg.python.org/cpython/file/2.7/Lib/Queue.py" rel="nofollow">Queue</a> module:</p> <pre><code>def _put(self, item, heappush=heapq.heappush): heappush(self.queue, item) def _get(self, heappop=heapq.heappop): return heappop(self.queue) </code></pre> <p>I wonder why the variables are used as function arguments here? Is it just a matter of taste or some kind of optimization?</p>