5 ms·
Functions are not usually as obvious as the creator thinks they are. Does get_height() include the optional border width or not? What does it return while the
by crazygringo 4y ago
Functions are not usually as obvious as the creator thinks they are.
Does get_height() include the optional border width or not? What does it return while the item is hidden? Does it return an int or float? Can it return a string value like "auto" or a null value? Under what circumstances should its value not be relied upon, e.g. while an animation is active? Why was it written as a function rather than a property? And so forth.
Requiring a comment is helpful in reminding the author to explain why this code was even separated out as a separate function in the first place, and all of the potential gotchas around it.