logoalt Hacker News

pbalauyesterday at 12:17 PM3 repliesview on HN

If you change an operation that is meant to return a Boolean to return anything else, you are insta fired.


Replies

vtbassmattyesterday at 1:41 PM

I would have agreed with this, and then they did the `pathlib.Path` bit of cuteness with the `/` operator: https://github.com/python/cpython/blob/5afbb60e0283caaf34990...

And despite my misgivings, it’s really ergonomic.

show 1 reply
echoangleyesterday at 12:28 PM

You mean like the numpy authors that let the comparison operators return arrays?

Also, apparently SQLAlchemy does exactly what I proposed so apparently they are erring in their ways too.

I honestly don’t find it that bad.

BrenBarnyesterday at 10:23 PM

That's a well established pattern in Python, for instance with Numpy. That's the point. Operations in Python aren't "mean to return" anything in particular. Each class can define the operations as it wants. That's a powerful feature that allows creation of specialized expression languages, as used by other ORMs besides Django.