Draft
Conversation
Collaborator
|
Hey there and thank you for opening this pull request! 👋 We require pull request titles to follow the Conventional Commits specification Your title should look like this. The scope field is optional. If the PR includes a breaking change, mark it with an exclamation mark: and include a "BREAKING CHANGE:" footer in the body of the pull request. Details: |
Member
Author
|
If we go with separate package should that have it's own repo or can it live here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
NOT INTENDED FOR MERGING, JUST FOR DISCUSSION.
There are a bunch of common/pythonic things one would want to do on core types that we don't provide pre-existing functionality for. I think we should provide it in some way.
The limitations are primarily that without some kind of trait/type class system it is hard to provide this stuff generically (e.g. functions that work for all iterators over some type). Given this is something Guppy may add in future, I am reluctant to include things in the standard library.
I propose instead providing this from a separate package that isn't tied to language stability or maintenance. This package:
In this RFC PR I have collected some such functions I had lying around. It includes:
I have taken the approach of making these functions look like common python equivalents. But the resemblance is superficial since they only work on types. An alternative approach is to make them methods on the array type, rust style, which might make it more palatable for the standard library but with the obvious downside that people won't naturally find them and use them.
Some missing things I'd like to add: