[SciPy-user] fsolve and additional parameters

Fernando Perez Fernando.Perez at colorado.edu
Mon Jul 19 17:46:43 CDT 2004


matt wrote:
> class subclassname(superclassname):
> 	def equations(self,x)
> 		return self,x

You probably want to use something like

	def equations(self,x):
		return x

Note that your pseudocode was lacking ':' at the end of the def.

You might want to read up a bit on python's object model to understand better 
how 'self' is passed around, since your questions are more related to handling 
of methods in python than to fsolve itself.

Note that you rarely return 'self', and when you do, it's typically returned 
alone (not with additional things) for purposes of method chaining:

foo.meth1().meth2().meth3()

can only be done if each of methN returns self (or some suitable copy thereof).

HTH.

Best,

f



More information about the SciPy-user mailing list