News for hackers. Stuff that matters.
Re:Ask HN: Anyone know any funny programming jokes? by numlocked on Thursday January 21, 2021 @01:26AM (#25856115)
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.

There are no comments on this comment yet.