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

fastcore.utils.Tuple shadows typing.Tuple #36

Closed
indigoviolet opened this issue May 13, 2020 · 4 comments
Closed

fastcore.utils.Tuple shadows typing.Tuple #36

indigoviolet opened this issue May 13, 2020 · 4 comments

Comments

@indigoviolet
Copy link

It surprised me with an unexpected error that fastcore.utils.Tuple exists -- it shadows the stdlib's typing.Tuple. Should this be renamed to something that doesn't collide with the stdlib, or is this expected?

@tcapelle
Copy link

it is expected, you can just use this one.

@sgugger
Copy link
Contributor

sgugger commented May 13, 2020

You can always import the original typing.Tuple by giving it another name: from typing import Tuple as OldTuple.

@sgugger sgugger closed this as completed May 13, 2020
@indigoviolet
Copy link
Author

Hi, thanks for the quick responses.

  1. I don't think I can use fastcore.utils.Tuple as typing.Tuple: see this gist where it breaks: https://gist.github.com/indigoviolet/175556625b9e21748fe2d2be6500a1bb

  2. I understand that I can import typing.Tuple as OldTuple, but IMHO a library shouldn't shadow a standard library name without a very good reason, and should definitely not break it. I would expect fastcore.utils.Tuple to require explicitly importing it if it needs to be named Tuple.

@indigoviolet
Copy link
Author

hey @sgugger , @tcapelle -- not sure if you saw my comment above after closing this issue..

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

No branches or pull requests

3 participants