Closed
Description
Right now they are defined as:
self.items = items
self.can_be_true = len(self.items) > 0
self.can_be_false = len(self.items) == 0
But, I can see a potential inconsistency here. Since items
is writable and mutable (list
), someone (let's say in a plugin) can add an item to Tuple
, Union
, or TypedDict
without updating can_be_true
and can_be_false
attributes.
But, @property
s are dynamically computed, so it will always produce the correct result.
It is also used not-to-often, so it should not slow down the whole program.
I will send a PR with the proposed changes.