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

Get or create import function #246

Open
guybedford opened this issue Jun 23, 2023 · 1 comment
Open

Get or create import function #246

guybedford opened this issue Jun 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@guybedford
Copy link
Collaborator

Currently add_import_function on Module will allow adding duplicate imports, which is usually undesired.

A new get_or_create_import_function primitive would be very useful to enable idempotent semantics and avoiding of duplicate imports. Alternatively the existing add_import_function could possible be extended, but we are focusing on full backwards compat on the API for the most part, preferring to deprecate APIs over changing them.

@guybedford guybedford added the enhancement New feature or request label Jun 23, 2023
@guybedford
Copy link
Collaborator Author

Similiar functionality could also be useful for adding types and other types that have some level of equality. Of course type equality should also be performed for get_or_create_import_function, throwing an error if the types are different for the same import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant