Recursive method in class

Jan van den Broek balglaas at dds.nl
Fri Sep 27 08:26:57 EDT 2019


On 2019-09-27, ast <none at gmail.com> 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, n-2) + fib(self, n-1)
                  self.fib(...)

[Schnipp]

-- 
Jan v/d Broek
balglaas at dds.nl



More information about the Python-list mailing list