oop issue

Peter Otten __peter__ at web.de
Mon May 23 18:35:21 EDT 2022


On 23/05/2022 22:54, Tola Oj wrote:
> i just finished learning oop as a beginner and trying to practice with it
> but i ran into this typeerror issue, help please.
>
> Traceback (most recent call last):
>    File
> "c:\Users\ojomo\OneDrive\Desktop\myexcel\oop_learn.py\myExperiment.py\mainMain.py",
> line 36, in <module>
>      print(invest_crypto.client_list)
> TypeError: invest_crypto.__repr__() missing 1 required positional argument:
> 'self'

>      @staticmethod
>      def __repr__(self):
>          return f"('{self.name}', '{self.surname}', '{self.amount_Deposited}',
> '{self.amount_to_transfer}')"

What are you trying to achieve with the staticmethod decorator?


More information about the Python-list mailing list