Skip to main content
1 of 2
9000
  • 24.3k
  • 4
  • 52
  • 79

I would use built-in lists for any lists (uniform variable-length sequences of objects).

I would use namedtuple-derived classes to store data with known fixed sets of named fields. It's like objects, but immutable.

So you'd have your text.tokens[3].part_of_speech == NOUN, but won't have text.tokens[3].part_of_speech = NOUN. Immutability is often useful at preventing a whole class of errors, though.

9000
  • 24.3k
  • 4
  • 52
  • 79