Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think they are referring to this sort of thing (the reader will have to use their imagination and assume there is additional functionality in this class):

  class ReadingMaterial:
    is_magazine = False

    def is_periodical():
      return is_magazine

Using a base class (e.g. a Magazine and a Book class, or something) and inheritance, is much clearer than monkeying around with state.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: