Consider making TransformGraph generic over the space type
#72
Replies: 2 comments 1 reply
-
|
I don't disagree with this and is probably how I would do it in any other language, but in this case I don't think it provides a lot of value compared to the pain of using and enforcing generics in python. The downsides of not enforcing types here are
The upside of flexibility on types are
|
Beta Was this translation helpful? Give feedback.
-
This I don't think is a downside; Even if they hash to the same thing, I doubt they'd compare as equal via
I'm more thinking if one accidentally uses two different types of spaces, it's possible to query the graph and get a "vert not found" error, which looks like a legitimate error, but it comes from an illegitimate usage.
A user can still get such flexibility by setting the type of the verts to In fact, maybe something like this, with the default class StrictTransformGraph[ArrayT, VertT: Hashable = Hashable]:
pass
That's true... though I still wonder if |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently,
TransformGraphwill accept anyHashableas a space. This makes it so that wrong code like this is not flagged by a type checker:This of course raises the question of whether
Transformshould also be generic over the space type, so that one wouldn't be able to callmygraph.add_transform(my_transform)if themy_transformdoes not use the same space type asmygraph. It seems to me like Transform should also be generic of the space type, but I'd love to hear your thoughts on that as well.Beta Was this translation helpful? Give feedback.
All reactions