Pre-PEP: Dynamically evaluating default function arguments

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Jan 6 18:00:53 EST 2004


> From: Daniel Ehrenberg
> 
> One of the most common bugs that people have on the Python Tutor list
> are caused by the fact the default arguments for functions are
> evaluated only once, not when the function is called. The solution to
> this is usually to use the following idiom:

Please do write up this PEP formally and completely, covering every eventuality, and with the history and motivations expressed, so that it can be formally rejected. Then we will have somewhere simple to point to when people bring up this topic again.

Tim Delaney




More information about the Python-list mailing list