def function(arg=otherfunction(value)):
return arg

My expectation would have been that otherfunction(value) would be
called if (and only if) the arg keyword parameter was missing from the
function() call (ie. the optional value is evaluated the lazy way).
Also, otherfunction would be called each and every time this function()
is called without the arg keyword. (At least, I would have assumed this
before today)

Still, I can see why it's been implemented the way it has, it just
seems a shame there isn't a neat shortcut to default lots of optional
arguments to new mutable objects. And since I'm not the only one to
fall into this trap it makes me wonder why the default behaviour isn't
made to be what most people seem to expect?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to