Re: Recursive method in class

2019-10-02 Thread ast
Le 02/10/2019 à 12:22, Richard Damon a écrit : On 10/2/19 1:12 AM, ast wrote: Le 01/10/2019 à 20:56, Timur Tabi a écrit : Could you please fix your email software so that it shows a legitimate email address in the From: line?  Your emails all show this: From: ast All of your emails

Re: Recursive method in class

2019-10-02 Thread Chris Angelico
On Wed, Oct 2, 2019 at 9:01 PM David wrote: > > On Wed, 2 Oct 2019 at 15:15, ast wrote: > > Le 01/10/2019 à 20:56, Timur Tabi a écrit : > > > > Could you please fix your email software so that it shows a legitimate > > > email address in the From: line? > > > I choose: ast.donotans...@gmail.com

Re: Recursive method in class

2019-10-02 Thread David
On Wed, 2 Oct 2019 at 15:15, ast wrote: > Le 01/10/2019 à 20:56, Timur Tabi a écrit : > > Could you please fix your email software so that it shows a legitimate > > email address in the From: line? > I choose: ast.donotans...@gmail.com Hi ast, Please look here to see how your email looks on

Re: Recursive method in class

2019-10-02 Thread Richard Damon
On 10/2/19 1:12 AM, ast wrote: > Le 01/10/2019 à 20:56, Timur Tabi a écrit : >> Could you please fix your email software so that it shows a legitimate >> email address in the From: line?  Your emails all show this: >> >> From: ast >> >> All of your emails are being caught in my spam filter

Re: Recursive method in class

2019-10-01 Thread ast
Le 01/10/2019 à 20:56, Timur Tabi a écrit : Could you please fix your email software so that it shows a legitimate email address in the From: line? Your emails all show this: From: ast All of your emails are being caught in my spam filter because of this address. I would email you

Re: Recursive method in class

2019-10-01 Thread Grant Edwards
On 2019-10-01, Timur Tabi wrote: > Could you please fix your email software so that it shows a legitimate > email address in the From: line? Your emails all show this: > > From: ast > > All of your emails are being caught in my spam filter because of this > address. I would email you

Re: Recursive method in class

2019-10-01 Thread Timur Tabi
Could you please fix your email software so that it shows a legitimate email address in the From: line? Your emails all show this: From: ast All of your emails are being caught in my spam filter because of this address. I would email you privately, but I know n...@gmail.com isn't your

Re: Recursive method in class

2019-10-01 Thread ast
Le 01/10/2019 à 13:18, Rhodri James a écrit : On 01/10/2019 08:37, ast wrote: The problem is that "factorial" in line "return n * factorial(self, n - 1)" should not have been found because there is no factorial function defined in the current scope. Not so.  "factorial" is in the global

Re: Recursive method in class

2019-10-01 Thread Rhodri James
On 01/10/2019 08:37, ast wrote: I understood your example, but it doesn't answer my initial question. I try to rewrite my question: The following code is working well and I don't really understand why def factorial(self, n):     if not n:     return 1     else:     return n *

Re: Recursive method in class

2019-10-01 Thread Terry Reedy
On 10/1/2019 3:37 AM, ast wrote: The following code is working well and I don't really understand why def factorial(self, n):     if not n:     return 1     else:     return n * factorial(self, n - 1) This creates a function that looks up 'factorial' in the global (module) scope

Re: Recursive method in class

2019-10-01 Thread ast
Le 30/09/2019 à 13:11, Anders Märak Leffler a écrit : What do you mean by transformed? This is probably your understanding already, but a further consequence of when arguments are evaluated plus what you said about data attributes is that the fib(self, n - 1) call will follow the standard

Re: Recursive method in class

2019-09-30 Thread Anders Märak Leffler
27/09/2019 à 14:26, Jan van den Broek a écrit : > > On 2019-09-27, ast wrote: > >> Is it feasible to define a recursive method in a class ? > >> (I don't need it, it's just a trial) > >> > >> Here are failing codes: > >> > >> > &g

Re: Recursive method in class

2019-09-30 Thread ast
Le 27/09/2019 à 14:26, Jan van den Broek a écrit : On 2019-09-27, ast wrote: Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self,

Re: Recursive method in class

2019-09-27 Thread Dan Sommers
On 9/27/19 7:54 AM, ast wrote: Hello Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2) + fib(self, n-1) return self.fi

Re: Recursive method in class

2019-09-27 Thread Jan van den Broek
On 2019-09-27, ast wrote: > Is it feasible to define a recursive method in a class ? > (I don't need it, it's just a trial) > > Here are failing codes: > > > class Test: > def fib(self, n): > if n < 2: return n > retu

Re: Recursive method in class

2019-09-27 Thread Rhodri James
On 27/09/2019 12:54, ast wrote: Hello Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test:     def fib(self, n):     if n < 2: return n     return fib(self, n-2) + fib(self, n-1) Try self.

Recursive method in class

2019-09-27 Thread ast
Hello Is it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2) + fib(self, n-1) t = Test() t.fib(6) - Traceback (m