Why are functions atomic? (I.e. they are not copied.) For example, I would like to make a copy of a function so I can change the default values:
>>> from copy import copy >>> f = lambda x: x >>> f.func_defaults = (1,) >>> g = copy(f) >>> g.func_defaults = (2,) >>> f(),g() (2, 2) I would like the following behaviour: >>> f(),g() (1,2) I know I could use a 'functor' defining __call__ and using member variables, but this is more complicated and quite a bit slower. (I also know that I can use new.function to create a new copy, but I would like to know the rational behind the decision to make functions atomic before I shoot myself in the foot;-) Thanks, Michael. -- http://mail.python.org/mailman/listinfo/python-list