Re: function factory question: embed current values of object attributes

2009-02-21 Thread Alan Isaac
Gabriel Genellina wrote: If you want a "frozen" function (that is, a function already set-up with the parameters taken from the current values of x.a, x.b) use functools.partial: OK, that's also a nice idea. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: function factory question: embed current values of object attributes

2009-02-21 Thread Alan Isaac
Terry Reedy wrote: You are now describing a function closure. Here is an example that might help. It does. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: function factory question: embed current values of object attributes

2009-02-20 Thread Gabriel Genellina
En Fri, 20 Feb 2009 16:49:21 -0200, Alan Isaac escribió: I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, but is there way to communicate to a method that it depends only on the initial values of

Re: function factory question: embed current values of object attributes

2009-02-20 Thread Terry Reedy
Alan Isaac wrote: I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, 'Parameters' are the function local names in the header that get bound to argument objects when the function is called. What you

function factory question: embed current values of object attributes

2009-02-20 Thread Alan Isaac
I have a class `X` where many parameters are set at instance initialization. The parameter values of an instance `x` generally remain unchanged, but is there way to communicate to a method that it depends only on the initial values of these parameters (and does not need to worry about any changes