How do I type hint a question that returns a zip object? #1279
Unanswered
nguyenlethaihoang
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I did a Google search for this and found this StackOverflow post which has your exact code in it. (This explains why you pasted an image instead of the code as text.) That post has an accepted answer: def sort_as_one(*args: T) -> typing.Iterator[T]:
return zip(*sorted(zip(*args))) Not to make this weird but you should just be up front if you're asking about code from a StackOverflow post. There's nothing wrong with doing that. Is there something else you wanted to ask about it? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got a function that takes an arbitrary amount of lists (or any iterables, for that matter) and sorts them as one. The code looks like this:
How can I accurately type hint the function output?
Beta Was this translation helpful? Give feedback.
All reactions