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

Support “Reuse[Dep1] | Dep2” #30

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gallaecio
Copy link
Member

e.g.

request_or_response_url: Reuse[ResponseUrl] | RequestUrl

Should use RequestUrl unless ResponseUrl is also requested separately.

@Gallaecio
Copy link
Member Author

Gallaecio commented Dec 27, 2023

I run into a fundamental issue that I was not expecting:

>>> from andi.andi import Reuse
>>> class A:
...   pass
... 
>>> class B:
...  pass
... 
>>> Reuse[A] | B == B | Reuse[A]
True

From the docs:

When comparing unions, the order is ignored

Should I try to find a work around that? Maybe a different syntax? (e.g. Reuse[A, B], or Reuse[A, 0] | Reuse[B, 1] | C)
Should we only support 1 reuse per dependency (i.e. no support for Reuse[A] | Reuse[B] | C), and assume that even in A | Reuse[B] we should prioritize B if it can be reused, even if A comes first?

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

Successfully merging this pull request may close these issues.

1 participant