@cewing Thanks. I'll keep your recommendation in mind. I can see an argument for both: Passing exactly what the function needs increases reusability, but passing an entire collection of things streamlines function call. I realized i was using both styles in one project, so I wanted to know what reasons you might have for picking one over the other. My trend seems to be to pass just what the function needs for functions that transform a single value such as:
sanitize_id(id_): u"""Remove invalid username characters. Characters are removed here instead of being labled as invalid at username generation because the API for one service automatically adds a special character to the id that another service does not allow. """
but I also tend to pass entire collections to helper functions if the calling function accepts a collection:
get_or_create_customer() needs to accept a collection of customer attributes in case it needs to create a customer, so
_get_customer() accepts the same type of collection.
def function(argument): u"""Docstring.""" return argument += 1