
I was looking for a way to set a function being equal to another function: q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); I was hoping to use something like this: (q).__setcall__.(m+1) = (q).__setcall__.(m)+ ((-1)^m) * exp(lnanswer); As a work around. But I have not found the `__setcall__' built in being there. Here is the code block I'm working with: indvar = 200; q = 0; lnanswer = 0; for m = 1:150 lnanswer = (3 * m) * log(indvar) - log(factorial(3 * m)) ; q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); end lnanswer q Any help would be appreciated. Thank you

2010/10/24 Bj Raz <whitequill.bj@gmail.com>:
I was looking for a way to set a function being equal to another function: q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); I was hoping to use something like this: (q).__setcall__.(m+1) = (q).__setcall__.(m)+ ((-1)^m) * exp(lnanswer); As a work around. But I have not found the `__setcall__' built in being there.
Here is the code block I'm working with:
indvar = 200; q = 0; lnanswer = 0; for m = 1:150 lnanswer = (3 * m) * log(indvar) - log(factorial(3 * m)) ; q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); end lnanswer q
Any help would be appreciated.
Please see python-list. This list is for the development of python. The SAGE math package can do something like this. -- Regards, Benjamin

I'll look into SAGE, I am still curious if there is, a way, to write this in native python, cause I'm currently plotting in Autodesk Maya, and using Python. Sent from my iPhone On Oct 24, 2010, at 12:51 PM, Benjamin Peterson <benjamin@python.org> wrote:
2010/10/24 Bj Raz <whitequill.bj@gmail.com>:
I was looking for a way to set a function being equal to another function: q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); I was hoping to use something like this: (q).__setcall__.(m+1) = (q).__setcall__.(m)+ ((-1)^m) * exp(lnanswer); As a work around. But I have not found the `__setcall__' built in being there.
Here is the code block I'm working with:
indvar = 200; q = 0; lnanswer = 0; for m = 1:150 lnanswer = (3 * m) * log(indvar) - log(factorial(3 * m)) ; q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer); end lnanswer q
Any help would be appreciated.
Please see python-list. This list is for the development of python.
The SAGE math package can do something like this.
-- Regards, Benjamin

On 10/26/10 5:05 PM, Bj Raz wrote:
I'll look into SAGE, I am still curious if there is, a way, to write this in native python, cause I'm currently plotting in Autodesk Maya, and using Python.
This thread is off-topic for python-dev, which is intended for the development *of* the Python interpreter, not development *in* Python. We should continue this discussion on python-list, instead: http://mail.python.org/mailman/listinfo/python-list That said, I will answer your question. No, there is no way to do this in Python. However, I don't think that is what the code you are trying to emulate does. It looks like it is building up a list of values, not defining a function. If you take your question over to python-list, I can explain more. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

Robert Kern wrote:
This thread is off-topic for python-dev, which is intended for the development *of* the Python interpreter, not development *in* Python.
I got the impression that he was asking for a new feature -- i.e. to be allowed to write a call on the left of an assignment, with a corresponding special method. If that's the case, the appropriate place for initial discussion would be python-ideas. -- Greg
participants (4)
-
Benjamin Peterson
-
Bj Raz
-
Greg Ewing
-
Robert Kern