Optional parameter object re-used when instantiating multiple objects
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Nov 20 22:19:22 EST 2008
On Wed, 19 Nov 2008 10:05:23 -0800, Dennis Lee Bieber wrote:
> Do you really want a "default" argument that changes value depending
> upon actions performed in the /surrounding/ scope?
And if you do, it is easy to get:
default_y = "something"
def parrot(x, y=None):
if y is None:
y = default_y
--
Steven
More information about the Python-list
mailing list