| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
Looks promising!
Sorry, something went wrong.
There was a problem hiding this comment.
Nice! Looks like you now just need to update some assertions in the test-case file to use Union[int, Any] rather than Any in order to make the test case pass.
Sorry, something went wrong.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
One doubt I have is whether we should change it so that slice[A] = slice[A, A, A] after all. Without this convention, describing the most commonly used slice type, which I think is slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]Probably requires an alias since it is so long. Moreover, I think we need to clarify whether the collections.abc.Sequence protocol requires __getitem__ to support slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], or if slice[int | None, int | None, int | None] is sufficient. This is likely a critical case as many users want to subclass Sequence, and it shouldn't be too inconvenient to type hint the implementation. |
Sorry, something went wrong.
|
@AlexWaygood #13008 is the same as this, but defaults step to start | stop, so that slice[SupportsIndex | None] gives us the most commonly used slice type. In this case, people who want to use datetime/timedelta need to annotate with 3 values. A decision needs to be made between:
|
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Different overloads than #12899, testing mypy primer.
slice.__new__ now follows a very simply rule: any None argument will result in the corresponding Generic Type to be considered as Any.