On Aug 25, 10:35 am, Arnaud Delobelle <arno...@gmail.com> wrote: > You're close to the usual idiom: > > def doSomething(debug=None): > if debug is None: > debug = defaults['debug'] > ... > > Note the use of 'is' rather than '==' > HTH
Hmm, from what you are saying, it seems like there's no elegant way to handle run time defaults for function arguments, meaning that I should probably write a sql-esc coalesce function to keep my code cleaner. I take it that most people who run into this situation do this? def coalesce(*args): for a in args: if a is not None: return a return None def doSomething(debug=None): debug = coalesce(debug,defaults['debug']) # blah blah blah -- // T.Hsu -- http://mail.python.org/mailman/listinfo/python-list