Closed jack-tutor closed 10 months ago
please spend a few minutes and search the issue tracker next time
I looked at the issue tracker prior to posting this and have since looked.
Searching for the terms of type
generic
3.12
695
parameter
and looking at all open issues - this is the closest issue I can find: https://github.com/asottile/pyupgrade/issues/836
It's entirely possible I am still missing this - but short of looking through all the closed issues in the repo - I'm not sure how to find the answer here. If nothing else - linking to the answer here would help someone else who might use the same search terms as me.
why not 695 ?
ah you did find the duplicate -- great! next time do that first so you don't even need to waste both of our time opening an issue about it
Are you saying that the issue I am raising here is a duplicate of https://github.com/asottile/pyupgrade/issues/836? That issue is about the new type alias syntax - I am talking about generics (there is overlap, but not complete).
As in this:
def max[T](args: Iterable[T]) -> T:
...
class list[T]:
def __getitem__(self, index: int, /) -> T:
...
def append(self, element: T) -> None:
...
This seems to me a distinct concern and feature from what is discussed in 836
yes it is an exact duplicate
I really appreciate this tool - it's very useful.
I was wondering whether there is a plan to support conversion to the new (much cleaner) generic typing syntax in 3.12: https://docs.python.org/3/whatsnew/3.12.html#pep-695-type-parameter-syntax.
I could imagine this being very complex (one potential issue would be handling
TypeVar
s used in a generic in one function but imported from another file) especially while maintaining correctness. But I was curious if this has been considered/if there is a concrete plan to support this eventually or a decision that it is beyond the scope ofpyupgrade
.Thanks