Skip to content

Support concatenating lists with different contents #5260

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

Closed
wants to merge 1 commit into from

Conversation

mrkmndz
Copy link
Contributor

@mrkmndz mrkmndz commented Apr 27, 2021

I believe this type relaxation is sound, given that __add__ creates a new list, so should be equivalent to [*self, *x], which works like this.

@mrkmndz mrkmndz marked this pull request as draft April 27, 2021 23:58
@JelleZijlstra
Copy link
Member

#3183 was the last attempt to do this, and previously we had #2404. Unfortunately it's been hard to get right.

@mrkmndz
Copy link
Contributor Author

mrkmndz commented Apr 28, 2021

makes sense, I'll defer to #3183 then.

@mrkmndz mrkmndz closed this Apr 28, 2021
@mrkmndz mrkmndz deleted the list branch April 28, 2021 00:04
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

mypy (https://github.com/python/mypy.git)
+ mypy/strconv.py:410: error: Unsupported operand types for + ("List[Any]" and "List[Union[str, Tuple[str, List[Any]]]]")  [operator]
+ mypy/test/testcmdline.py:59: error: Unsupported operand types for + ("List[str]" and "List[str]")  [operator]
+ mypyc/test/test_commandline.py:51: error: Unsupported operand types for + ("List[str]" and "List[str]")  [operator]

ignite (https://github.com/pytorch/ignite)
+ ignite/contrib/handlers/time_profilers.py:257: error: unused 'type: ignore' comment

pydantic (https://github.com/samuelcolvin/pydantic.git)
+ pydantic/color.py:199: error: unused 'type: ignore' comment

graphql-core (https://github.com/graphql-python/graphql-core.git)
+ src/graphql/type/validate.py:387: error: Unsupported operand types for + ("List[NamedTypeNode]" and "List[NamedTypeNode]")
+ src/graphql/validation/rules/overlapping_fields_can_be_merged.py:81: error: Unsupported operand types for + ("List[FieldNode]" and "List[FieldNode]")

pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/core/computation/scope.py:335: error: unused 'type: ignore' comment
+ pandas/core/computation/scope.py:336: error: unused 'type: ignore' comment
+ pandas/io/common.py:513: error: unused 'type: ignore' comment
+ pandas/io/stata.py:909: error: unused 'type: ignore' comment
+ pandas/io/pytables.py:3445: error: unused 'type: ignore' comment
+ pandas/tests/reshape/concat/test_append.py:195: error: unused 'type: ignore' comment
+ pandas/tests/frame/indexing/test_setitem.py:231: error: unused 'type: ignore' comment

paasta (https://github.com/yelp/paasta.git)
+ paasta_tools/config_utils.py:72: error: Unsupported operand types for + ("List[str]" and "List[str]")


tornado (https://github.com/tornadoweb/tornado.git)
+ tornado/autoreload.py:238: error: Unsupported operand types for + ("List[str]" and "List[str]")

@hauntsaninja
Copy link
Collaborator

Looks like we still have the weird List[str] + List[str] issues (#3183 (comment)).

This is definitely one for #1339

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

Successfully merging this pull request may close these issues.

3 participants