jmsv/ety-python

Shouldn't be possible to reassign Word.word property

jmsv opened this issue · 3 comments

jmsv commented

Word.origins is cached for an instance of a Word object - if word property is changed, origins is out of date

👍

Does .word become a @property (seems better than marking it private (._word)?

If so, on the @word.setter do we recalculate the origins, or raise an exception?

jmsv commented

Yeah, making it a property is a good idea

I was thinking either:

  • Raise an exception so a Word object can't be reassigned
  • Reinitialise _origins cache so it's recalculated when origins is next called, if at all
jmsv commented

This applies to Word.language too: shouldn't be reassigned