Skip to content
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

Consider providing same-return-type slice methods #21

Open
gabbard opened this issue Jan 25, 2019 · 0 comments
Open

Consider providing same-return-type slice methods #21

gabbard opened this issue Jan 25, 2019 · 0 comments

Comments

@gabbard
Copy link

gabbard commented Jan 25, 2019

On #20, @ConstantineLignos noted

One comment to remove, and then one general question: in slicing, typically slicing an X[T] returns another X[T]. For example, a list slice returns a list, a tuple slice returns a tuple. Here, when an ImmutableList/Set is sliced, we return a tuple. I don't know whether this is the right thing to do. The current solution is probably the best performance-wise, but it is a bit unusual.

@rgabbard replied

re: slicing, I think the performance impact is probably too big to do anything else, and the type signature should hopefully alert the user to any clash of expectations (and if they aren't using mypy, it's their own fault :-P ). We could consider adding another method to produce ImmutableX-typed slices, though, for those willing to pay the performance penalty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant