liskov-substitution-principle

mypy seems to think that (*args, **kwargs) could match to any funtion signature?

mypy seems to think that (*args, **kwargs) could match to any funtion signature? Question: How does mypy apply the Liskov substitution principle to *args, **kwargs parameters? I thought the following code should fail a mypy check since some calls to f allowed by the Base class are not allowed by C, but it actually passed. …

Total answers: 2

Python understanding Liskov Substiution Principle

Python understanding Liskov Substiution Principle Question: In this example, am I violating LSP? Since straight up replacing the last two lines with an instance of a subclass will give me an error(as wage isn’t initialised)? person_1 = Employee(‘Brad’) person_1.print_name() @dataclass class Person: name: str def print_name(self): print(self.name) @dataclass class Employee(Person): wage: int person_1 = Person(‘Brad’) …

Total answers: 3