Use a class type in it - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Use a class type in it (/thread-39306.html) |
Use a class type in it - MathisDELAGE - Jan-28-2023 Hello, I want to use a description for my parameter of my class method and that give this class Player: def __init__(self, name: str) -> None: self.name = name def battle(self, opponent: Player) -> int: print(f"Battle betwen {self.name} and {opponent.name}") return 0(It's the :Player who don't work) If anyone have an idea. Thanks in advance. RE: Use a class type in it - Gribouillis - Jan-28-2023 Use : "Player" instead of : Player .
RE: Use a class type in it - MathisDELAGE - Jan-29-2023 (Jan-28-2023, 11:19 PM)Gribouillis Wrote: Use Ok it work now Thanks |