Wessel
Wessel
@Wouter1 here is an example with two initialisation methods: ```python from plum import dispatch class B: def __init__(self, x: int | str): self._init(x) @dispatch def _init(self, x: int): self.b =...
> For instance, what if you have init/1 and init/2 for instance? Like init(int) and init(str,str)? You can use default arguments: ```python from plum import dispatch class B: def __init__(self,...
> The next step would be using a general vararg. And then we're exactly where we are now: you can not infer the types anymore and I can't build the...
> But again "you can not infer the types anymore and I can't build the list from the dict.". Could you elaborate on what you mean by not being able...
Hmm, one possible solution would to not pass the description as a dictionary but as plain arguments, and pass these to the class: ```python from plum import dispatch def instantiate(cls,...
@Moosems Thanks! Good suggestion. I've added this to the docs.
@leycec, that's a fantastic reply. :) Super interesting. The choices that you've made are very sensible. I agree that in the majority of situations you can find a type which...
> Gah! GitHub ate my whole comment. 😭 Every once in a while this happens to me too. Bah! > By "type t", do we mean "type hint t" where...
> Would something like that be useful? Say "Yes! Odin, yes!" and receive a free meme. Interesting! Caching with a function `type_of` works whenever `is_bearable(x, t) == TypeHint(type_of(x))
@leycec Are you considering to implement `is_bearable` using `infer_type` in the case of deep types, or would you just offer this as an alternative to the user in case they...