-
-
Notifications
You must be signed in to change notification settings - Fork 49
Re-use joinpath logic in Traversable and MultiplexedPath #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the look at the PR and it seems good. Thank you for splitting each logical change into its own commit.
I only have one note.
try: | ||
return next(matches).joinpath(*names) | ||
except StopIteration: | ||
raise TraversalError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way for this to happen is no arguments being passed, no? Wouldn't checking for that directly make the code easier to read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's correct. A StopIteration
would occur if none of the traversable.name == target
in the matches
above (including if self.iterdir()
yields no results). It's trapping StopIteration
on next(matches)
, not *names
. *names
can be empty. Maybe only the exception should be trapped for next(matches)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, that makes sense.
…concrete implementation.
…rts for getting the parts.
779f59e
to
1def9a2
Compare
Inspired by #248 (comment)