Re: comments? storing a function in an object

2009-07-25 Thread Aahz
In article 20efdb6a-c1a5-47dc-8546-7c4ae548e...@g1g2000pra.googlegroups.com, Carl Banks pavlovevide...@gmail.com wrote: On Jul 22, 8:38=A0pm, a...@pythoncraft.com (Aahz) wrote: In article f3d88edf-b5d3-43e4-89a3-b05ef0f55...@p28g2000vbn.googlegroups= .com, Carl Banks =A0pavlovevide...@gmail.com

Re: comments? storing a function in an object

2009-07-23 Thread Aahz
In article f3d88edf-b5d3-43e4-89a3-b05ef0f55...@p28g2000vbn.googlegroups.com, Carl Banks pavlovevide...@gmail.com wrote: You have to be REALLY REALLY careful not to pass any user-supplied data to it if this is a server running on your computer, of course. Unless, of course, your users are

Re: comments? storing a function in an object

2009-07-23 Thread Carl Banks
On Jul 22, 8:38 pm, a...@pythoncraft.com (Aahz) wrote: In article f3d88edf-b5d3-43e4-89a3-b05ef0f55...@p28g2000vbn.googlegroups.com, Carl Banks  pavlovevide...@gmail.com wrote: You have to be REALLY REALLY careful not to pass any user-supplied data to it if this is a server running on your

Re: comments? storing a function in an object

2009-07-21 Thread I V
On Mon, 20 Jul 2009 21:53:59 -0400, Esmail wrote: 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

Re: comments? storing a function in an object

2009-07-21 Thread Gabriel Genellina
En Mon, 20 Jul 2009 22:53:59 -0300, Esmail ebo...@hotmail.com escribió: 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

comments? storing a function in an object

2009-07-20 Thread Esmail
Hello all, I am trying to store a function and some associated information in an object so that I can later have series of functions in a list that I can evaluate one at a time. Right now I am only storing the function itself, the number of arguments it expects and its string representation. I

Re: comments? storing a function in an object

2009-07-20 Thread Francesco Bochicchio
On Jul 20, 6:22 pm, Esmail ebo...@hotmail.com wrote: Hello all, I am trying to store a function and some associated information in an object so that I can later have series of functions in a list that I can evaluate one at a time. Right now I am only storing the function itself, the number

Re: comments? storing a function in an object

2009-07-20 Thread Gabriel Genellina
En Mon, 20 Jul 2009 14:44:16 -0300, Francesco Bochicchio bieff...@gmail.com escribió: On Jul 20, 6:22 pm, Esmail ebo...@hotmail.com wrote: Hello all, I am trying to store a function and some associated information in an object so that I can later have series of functions in a list that I

Re: comments? storing a function in an object

2009-07-20 Thread Esmail
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

Re: comments? storing a function in an object

2009-07-20 Thread Esmail
Hi Francesco, Those were great suggestions! Re 1: I used the __doc__ attribute to eliminate the parameter in the constructor as you suggested. Also, much easier to specify the character string with the actual function than later to match it up like I was. class

Re: comments? storing a function in an object

2009-07-20 Thread Carl Banks
On Jul 20, 9:22 am, Esmail ebo...@hotmail.com wrote: def funct1(x):      ''' small test function '''      return x * x def funct2(x, y):      ''' small test function '''      return x + y def funct3(x):      ''' small test function '''      return 1000 + (x*x + x) * math.cos(x) def