I'm convinced making `str` also an `Iterable[str]`...
# development
b
I'm convinced making
str
also an
Iterable[str]
in typing-land is dangerous. We've had a long-standing bug in our graph traversal algorithm (for secondary ownership) it seems... With that hint, can you find the bug? https://github.com/pantsbuild/pants/blob/b7dee2e576beb5a49790cf5c1803418624631c1a/src/python/pants/engine/internals/graph.py#L904 (Answer in 🧵 )
p
Is someone setting
OwnersRequest.sources
to a str?
b
Inside of:
Copy code
for secondary_owner_field in secondary_owner_fields:
                matching_files.update(
                    *secondary_owner_field.filespec_matcher.matches(list(sources_set))
                )
We're unpacking a list of strings.
set.update
takes
*s: Iterable[T]
, meaning we're updating it with each character...
w
I'd agree, with iterables of iterables, I generally don't follow my same typing conventions (for better or worse)
I wonder if mypy could be configured in a similar manner to
pytype
with respect to
Iterable[str]
and
str
b
Oh uh, good job Google
f
this is a design mistake in python imo, the lack of a char type
but it's a very old mistake that will never go away