-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Can we remove the supertype in scope definitions? It does not seem to serve any purpose any more. Or am I missing something?
For example, when I remove SUPER from Scope:
class Scope(Generic[PARAM]):
def __init_subclass__(cls, **kwargs: Any) -> None:
return super().__init_subclass__(**kwargs)
def __new__(cls, x: T) -> T: # type: ignore[misc]
return xthis runs fine and passes type checks:
from typing import NewType, TypeVar
import sciline as sl
A = NewType('A', int)
B = NewType('B', int)
T = TypeVar('T', A, B)
class X(sl.Scope[T], int): ...
class Y(sl.Scope[T], int): ...
def foo(x: X[T]) -> Y[T]:
return Y[T](x + 1)
pl = sl.Pipeline([foo], params={X[A]: 3, X[B]: 4})
print(pl.visualize())
print(pl.compute(X[A]))Is the supertype simply a leftover from an earlier version of Sciline or do we still need it?
Of course, doping this would require a lot of changes in downstream code. But I think the reduced duplication would be worth it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels