logoalt Hacker News

Rewriting a 20-year-old Python library

15 pointsby PaulHoulelast Saturday at 2:12 PM6 commentsview on HN

Comments

esttoday at 8:43 AM

> providing both sync and async code paths in the same class, often using a naming scheme which prefixes the async versions of the methods with an a

I have a solution to write a single code path for both async and sync

https://news.ycombinator.com/item?id=43982570

show 1 reply
ratoday at 9:31 AM

Brings back memories if when b-list was on the front page of HN all the time.

Another approach to preserve the fully functional api is decorators.

globular-toasttoday at 7:46 AM

The binary "is spam" thing seems like a non-issue, unless I'm misunderstanding something. In Python you can easily implement Boolean attributes using predicates without breaking the API, like so:

    @property
    def is_spam(self) -> bool:
       return self._comment_check in {"true", "blatant"}
Then you can simply add another predicate to support the blatant case:

    @property
    def is_blatant_spam(self) -> bool:
       return self._comment_check == "blatant"
show 2 replies
consomidatoday at 9:45 AM

[dead]