Remix.run Logo
13hunteo 3 hours ago

If you want to handle the three cases individually using your implementation, you would have to make another function call, rather than just the one

globular-toast 2 hours ago | parent [-]

You don't, although it is perhaps quite awkard:

    message.is_blatant_spam  # true if blatant spam
    message.is_spam and not message.is_blatant_spam  # true if possibly spam
    not message.is_spam  # true if not spam
But there's nothing stopping adding that middle one as another property, again without breaking compatibility:

    @property
    def is_possibly_spam(self) -> bool:
       return self.is_spam and not self.is_blatant_spam
The point is, you don't actually have to break compatibility here, you can just define more predicates to add the extra granularity without breaking the existing ones.