Re: Liskov substitution principle

2011-07-15 Thread Ben Finney
would break the Liskov substitution principle, yes. Anything that asks for a Student instance should receive an object that can do at least everything Student can do. If you want to implement something that can't do some of the things Student can do, the Liskov substitution principle says you a

Re: Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation)

2011-07-15 Thread Chris Angelico
On Sat, Jul 16, 2011 at 10:04 AM, Ben Finney wrote: >        def study(self, subject): >            raise NotImplementedError > > See? We can have overstretched analogies *and* remain within the Liskov > substitution principle. > Hehe! Of course I was speaking utterly in jes

Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation)

2011-07-15 Thread Ben Finney
Chris Angelico writes: > The analogy with reality breaks down a bit here. I've seen plenty of > students with no idea of what it means to study. But Python can handle > that too - just 'del' the method in the subclass. No, please don't. That would break the Liskov