3 ms·
"Which in Python would become ... assert product(a, b) == 6" Python's got a lot more capacity for "DSLs" than it may immediately seem. Writing "it.shouldBeEqua
by jerf 12y ago
"Which in Python would become ... assert product(a, b) == 6"
Python's got a lot more capacity for "DSLs" than it may immediately seem. Writing "it.shouldBeEqual(product(2, 3))(6)" would be quite easy in Python, actually; it's got all sorts of overloads and you can return all sorts of excitingly overloaded values. You don't see it because it isn't considered "Pythonic", not because Python can't do that.
(And I'm with Python on this. Those "fluent" APIs spend way too much effort being cutesy and verbose and not enough effort being simple, transparent, and composable. It looks good in the common case but when you write good test code it stops looking so good when you're writing map(it.shouldBe.eq, testTable), and the fact that the cutesy "fluent" style takes even a baby step in the direction of discouraging anything like that is an immediate disqualification in my book. Oh, don't try to defend it by saying you can still do the map I said... I've got enough experience in such things myself to know that it's actually a bigger problem than I'm making it out to be, not a smaller one.)
- stdbrouw 12y agoKind of besides the point though -- that line in particular had nothing to do with blocks/inline functions.