Skip to content

Use Sequence instead of List for path param - #659

Merged
sobolevn merged 1 commit into
typeddjango:masterfrom
davidszotten:url_sequence
Jul 3, 2021
Merged

sobolevn merged 1 commit into
typeddjango:masterfrom
davidszotten:url_sequence

Conversation

@davidszotten

@davidszotten davidszotten commented Jul 3, 2021 •

Copy link
Copy Markdown
Contributor

Unlike List, which is invariant, Sequence is covariant, which lets
path accept lists of subsets of the Union as well.

I believe this is safe, as django doesn't mutate this input. I found
this comment helpful

Unlike `List`, which is invariant, `Sequence` is covariant, which lets
`path` accept lists of subsets of the `Union` as well.

I believe this is safe, as django doesn't mutate this input. I found
[this
comment](python/mypy#3351 (comment))
helpful

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@sobolevn
sobolevn merged commit 739b171 into typeddjango:master Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants