Skip to content
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

Will typing.Tuple die "in the first Python version released 5 years after the release of Python 3.9.0"? #1230

Closed
junkmd opened this issue Aug 2, 2022 · 6 comments
Labels
topic: other Other topics not covered

Comments

@junkmd
Copy link

junkmd commented Aug 2, 2022

I am developing some python-version-compatible library.

I was using only typing.Tuple for hinting.
But this way is depreciated by PEP585.
So I set up a conditional branch to use the built-in type tuple unless sys.version_info < (3, 9).

The type checker did not work well this way, so I submitted microsoft/pylance-release#3066 for help.

From the discussion, "It would be way too disruptive to delete these symbols from typing", so I was trying to eliminate the conditional branch.

However, some members of this repository have commented they will ”be removed".
#948 (comment)

And there are a number of things that could be interpreted for me as "the definition of Tuple in the namespace of the typing module will be removed" in some documentations.
https://docs.python.org/3/library/typing.html#module-contents
https://peps.python.org/pep-0585/#implementation

I was upset.

Does the above wording mean that the definition in the typing module will replace from Tuple = _TupleType(tuple, -1, inst=False, name='Tuple') to (such as) from builtins import tuple as Tuple?

Or will the definition named Tuple be removed?

@junkmd junkmd added the topic: other Other topics not covered label Aug 2, 2022
@srittau
Copy link
Collaborator

srittau commented Aug 2, 2022

There are currently no plans to remove the aliases from typing. But using the built-in generics - if possible - is certainly more future-proof. For now, it's perfectly fine to continue using the aliases from typing, although you should consider starting to use the built-in generics when dropping support for Python versions before 3.9.

@junkmd
Copy link
Author

junkmd commented Aug 2, 2022

@srittau

Thank you for your response.

There are currently no plans to remove the aliases from typing.

I am glad to hear that.

@srittau
Copy link
Collaborator

srittau commented Aug 2, 2022

And just to clarify: I expect that the aliases will be removed at some point, but I don't think we will even start to issue deprecation warnings before the end of life of Python 3.8 (at the end of 2024) as this would indeed be too disruptive. And even then I can see these types to have a fairly long deprecation period.

@AlexWaygood
Copy link
Member

See here for some related recent discussion: https://discuss.python.org/t/concern-about-pep-585-removals/15901

@junkmd
Copy link
Author

junkmd commented Sep 15, 2022

PEP585 has been updated by python/peps#2778.

My fears have been taken away.

Thanks for responses.

@junkmd junkmd closed this as completed Sep 15, 2022
@srittau
Copy link
Collaborator

srittau commented Sep 15, 2022

Thank you for bringing this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: other Other topics not covered
Projects
None yet
Development

No branches or pull requests

3 participants