Steve Holden wrote: > Suppose you did actually want to do this you have chosen about the worst > possible way: the use of global variables to condition function > execution is a sure way to get into trouble. Consider if somebody else > want to use your function: they also have to set a global in their > program to avoid your function raising an exception.
Do you think all discussion examples are included a producton application. > Fortunately Python has just the thing to make such horrors unnecessary: > the default argument value. Try something like this (untested): > > def g(flattening=True, *arg): > if flattening: > arg = flatten(arg) > return arg > > Obviously you could use either True or False for the default value. In > the case above the function flattens by default. You could also, if you > wished, have f() take the flattening argument, and always pass it to g(). > > Nothing very sophisticated here, just something to help you flex your > growing Python and programming muscles. Thanks for your good purposes. TV > regards > Steve -- http://mail.python.org/mailman/listinfo/python-list