Minor code refactoring.  Compute len() one fewer times on one code path. (GH-8094)

1 file changed