| > `is_foolike` to me, implies `test_for_abstract_quality_foo`. Yes, which is why when `is_foolike` tests that a string starts with 'foo', that's rather unexpected. If `is_foolike` actually describes the intention of the function, then the function testing for the string beginning with 'foo' is a bug, because it doesn't do what it's intended to do. Referring to "the quality of starting with 'foo'" as "abstract quality foo" isn't hiding implementation details, it's being opaque about what a function does. Put another way, "what a function does" isn't its implementation. "How a function does what it does" is its implementation. > `starts_with_foo` implies an assertion a string beginning with a particular prefix Yes, exactly. Because that is what it is intended to do, we hope, since that's what it does. That's NOT the implementation: there are plenty of different ways to implement testing whether a string starts with 'foo', and the name `starts_with_foo` isn't coupled to any of them. > The point being that even though, in this (again) entirely fictitious example, the intention of the method is different from it's implementation Yes. `starts_with_foo` is also different from the implementation, while still describing the intention of the method. Could you explain to me why you think `starts_with_foo(x)` describes the implementation `x.startswith('foo')` and not some other implementation (such as `x[:3] == 'foo'`)? |
If that’s acceptable, why is an IsFooLike which only checks one condition unacceptable, even though it (imo) expresses the same intention?