Section: Classes and instances

Instance method

python
python
class User:
    def greet(self) -> str:
        return f"Hello, {self.name}"

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Classes and instances
Basic class
Basic class
OpenIn sheetpythonsame section
Class variable
Class variable
OpenIn sheetpythonsame section
Class method
Class method
OpenIn sheetpythonsame section
Static method
Static method
OpenIn sheetpythonsame section
Dataclass
Dataclass
OpenIn sheetpythonsame section
Subclass
Subclass