comments? storing a function in an object

Esmail ebonak at hotmail.com
Mon Jul 20 21:53:59 EDT 2009


Gabriel Genellina wrote:
 >
> If you follow the above suggestions, you'll see that your Function class 
> becomes almost useless: a normal function already IS an object, so you 
> don't have to wrap it inside ANOTHER object unless you need very special 
> features.

Hello Gabriel,

In general I would agree with you, but in my specific case
I want so store some additional meta-data with each function, such
as the valid range for input values, where the max or minimum are located,
the name/source for the function etc. I am creating list of functions
for use in testing optimization code, so it seems best to store this
data along with the function I am going to optimize in order to verify
the results for a given range (for instance).

Esmail





More information about the Python-list mailing list