Skip to content

CallableType.copy_modified: accept sequence for arg_names - #14840

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
ikonst:2023-03-05-copy-modified
Mar 6, 2023
Merged

CallableType.copy_modified: accept sequence for arg_names#14840
JelleZijlstra merged 1 commit into
python:masterfrom
ikonst:2023-03-05-copy-modified

Conversation

@ikonst

@ikonstikonst commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

In #4070, CallableType.__init__ was changed to accept arg_names: Sequence[str | None] so we could pass e.g. list[str] to it. We're making a similar change to CallableType.copy_modified.

@ikonstikonst mentioned this pull request Mar 6, 2023
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
JelleZijlstra merged commit 2ab1d82 into python:masterMar 6, 2023
@JukkaL

Copy link
Copy Markdown
Collaborator

This may later have some performance implications, since Sequence operations are currently slower than list operations in compiled code. However, since this is using "bogus" types, there is no impact right now (bogus types are treated as Any by mypyc), and this change fine. I'm leaving this as a note for future readers that might look at this PR.

@ikonst
ikonst deleted the 2023-03-05-copy-modified branch March 6, 2023 14:36
@ikonst

Copy link
Copy Markdown
ContributorAuthor

@JukkaL Curious, does this matter given that the sequence is copied by list() in init?

@JukkaL

Copy link
Copy Markdown
Collaborator

A good point, it doesn't make a difference unless we change also __init__ to accept only concrete types.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ikonst@JukkaL@JelleZijlstra