Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9588

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

References <87ei1sb3x9.fsf@benfinney.id.au> <cf0e04cc-a065-4fc4-ab25-777adadafb81@glegroupsg2000goo.googlegroups.com> <mailman.1088.1310772475.1164.python-list@python.org> <87zkkf9jl7.fsf_-_@benfinney.id.au>
Date 2011-07-16 10:17 +1000
Subject Re: Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation)
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1095.1310775472.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jul 16, 2011 at 10:04 AM, Ben Finney <ben+python@benfinney.id.au> 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 jest, but this raises
(sorry, never could resist a bad pun) another question: What if the
base class implemented study(), and then LazyStudent subclasses
Student but makes study() raise NotImpl? Would that break things? In a
sense, it breaks the whole "this is a student so it should act like a
student" rule. Suppose it raised UtterApathyError instead - does that
break the LSP?

Chris A
PS. The world's first horseless signature... trapped in the air!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: list(),tuple() should not place at "Built-in functions" in documentation Inside <fancheyujian@gmail.com> - 2011-07-15 12:53 -0700
  Type checking versus polymorphism (was: list(),tuple() should not place at "Built-in functions" in documentation) Ben Finney <ben+python@benfinney.id.au> - 2011-07-16 09:24 +1000
    Re: Type checking versus polymorphism (was: list(),tuple() should not place at "Built-in functions" in documentation) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 12:47 +1000
      Re: Type checking versus polymorphism (was: list(), tuple() should not place at "Built-in functions" in documentation) Chris Rebert <clp2@rebertia.com> - 2011-07-15 22:02 -0700
        Re: Type checking versus polymorphism (was: list(), tuple() should not place at "Built-in functions" in documentation) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 16:33 +1000
  Re: list(), tuple() should not place at "Built-in functions" in documentation Chris Angelico <rosuav@gmail.com> - 2011-07-16 09:27 +1000
    Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation) Ben Finney <ben+python@benfinney.id.au> - 2011-07-16 10:04 +1000
      Re: Liskov substitution principle (was: list(), tuple() should not place at "Built-in functions" in documentation) Chris Angelico <rosuav@gmail.com> - 2011-07-16 10:17 +1000
        Re: Liskov substitution principle Ben Finney <ben+python@benfinney.id.au> - 2011-07-16 11:47 +1000
  Re: list(),tuple() should not place at "Built-in functions" in documentation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 14:06 +1000

csiph-web