Re: Convert string to mathematical function

2006-08-02 Thread jeremito
I was unaware of the exec and eval functions in Python. Without trying them, they seem to be what I want to do. I'll play around with it and see if I can figure it out. Thanks for the suggestions everyone. Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert string to mathematical function

2006-08-02 Thread Colin J. Williams
Nick Vatamaniuc wrote: > Jeremy, > > Which method of extension are you using? For example you can pass the > function to C++/C directly using weave, without the need to convert to > Python first. Python has a different syntax than C++. Also I assume you > want exponentiation in you example "x^2...

Re: Convert string to mathematical function

2006-08-01 Thread Nick Vatamaniuc
Jeremy, Which method of extension are you using? For example you can pass the function to C++/C directly using weave, without the need to convert to Python first. Python has a different syntax than C++. Also I assume you want exponentiation in you example "x^2..." and not 'xor', well, in Python th

Re: Convert string to mathematical function

2006-08-01 Thread John Machin
jeremito wrote: > I am extending python with C++ and need some help. I would like to > convert a string to a mathematical function and then make this a C++ > function. My C++ code would then refer to this function to calculate > what it needs. For example I want to tell my function to calculate

Re: Convert string to mathematical function

2006-08-01 Thread Felipe Almeida Lessa
Em Ter, 2006-08-01 às 18:45 -0700, jeremito escreveu: > I am extending python with C++ and need some help. I would like to > convert a string to a mathematical function and then make this a C++ > function. I may be wrong, but I don't think you can create new C++ functions on-the-fly. At least I

Convert string to mathematical function

2006-08-01 Thread jeremito
I am extending python with C++ and need some help. I would like to convert a string to a mathematical function and then make this a C++ function. My C++ code would then refer to this function to calculate what it needs. For example I want to tell my function to calculate "x^2 + 3x +2", but later