Replace typing.List with list and others
See original GitHub issuehttps://docs.python.org/3.9/whatsnew/3.9.html#pep-585-builtin-generic-types
Python 3.9 (and Python 3.7 if you do from __future__ import annotations
) will let you write
from typing import List
def a(my_arg: List) -> List:
return []
as
def a(my_arg: list) -> list:
return []
Same goes for typing.Dict
and a bunch of others, see https://www.python.org/dev/peps/pep-0585/
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (8 by maintainers)
Top Results From Across the Web
python - Using List/Tuple/etc. from typing vs directly referring ...
For typing.List and other sequence types you generally only specify the type for all elements; List[str] is a list of strings, of any...
Read more >typing — Support for type hints — Python 3.11.1 documentation
Source code: Lib/typing.py This module provides runtime support for type hints. The most fundamental support consists of the types Any, Union, Callable, ...
Read more >Find and replace text - Microsoft Support
Go to Home > Replace. Enter the word or phrase you want to replace in Find what. Enter your new text in Replace...
Read more >Type hints cheat sheet - mypy 0.991 documentation
(1, 2, 3) from typing import Union, Optional # On Python 3.10+, use the | operator when something could be one of a...
Read more >3. Strings, lists, and tuples — Beginning Python Programming ...
If we want to modify a list and also keep a copy of the original, we need to be able to make a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Perhaps another example of the same idea, replace
typing.Text
withstr
for--py3-plus
.Example input:
Example diff:
via #371