When designing and modifying APIs, ensure consistency in parameter naming, default values, and which functionality is exposed. Each API design decision should:
When designing and modifying APIs, ensure consistency in parameter naming, default values, and which functionality is exposed. Each API design decision should:
For example, when adding new parameters like in the truncate
method:
def truncate(self, max_length, stride=0, left=True):
"""Truncate the sequence(s) represented by this encoding
Args:
max_length: The maximum length to truncate to
stride: The length of the stride to use
left: Whether to truncate left (True) or right (False)
"""
# implementation
Ensure the parameter name (left
) clearly indicates what True
and False
values will do, and consider whether the default value matches users’ expectations and existing behavior. Document any parameters that might have ambiguous interpretations to prevent confusion.
Enter the URL of a public GitHub repository