Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
I'm in the process of deep-diving fastai (specifically the tabular sections) and fastcore while on a sabbatical. I'm a big fan so far - it's so user-friendly, and the programming style is reminding me why I got into programming to begin with 😄! While interacting with the notebooks I'm finding tiny opportunities to clean up the implementation and docs.
I hope this is seen as a positive contribution rather than bike shedding. If it doesn't look valuable, please let me know. I'd be more than happy to change my approach and try something else 😃
For interest sake, this PR is a small part of a broader clean up of the dispatch notebook available in my forked master branch (view the full diff here and the updated notebook here). That branch includes more work along these lines, as well as a restructuring of the docs that I found helpful in developing my understanding of the library. I'd be very happy to continue carving out PRs like this from that branch
Description of changes
(commit messages copied as-is)
Make it more dict-like with fewer lines where appropriate:
add
to__setitem__
setdefault
which cleans upTypeDispatch.add
Also renamed args for consistency: vars referring to keys are named
t
since they will always be types, and vars referring to values are named
v
(orvs
) because they may be functions or nested_TypeDict
s.