3 ms·
Suppose I already had two function functions like: def strip_prefix(prefix, str): ... def name_from_fooid(fooid): return strip_prefix("foo",
by adrianratnapala 8y ago
Suppose I already had two function functions like:
def strip_prefix(prefix, str):
...
def name_from_fooid(fooid):
return strip_prefix("foo", id)
Now is it better to call `name_from_fooid` or to call `strip_prefix` directly? It depends on the high-level semantics we are trying to express. But assuming we really are extracting a Name from a FooId, then the former is probably better.
But then if you want a name_from_fooid function, it's just an implementation detail that you happen to implement it on top of a strip_prefix utility.