ConfigSpace icon indicating copy to clipboard operation
ConfigSpace copied to clipboard

[Maint] Typing for `is_legal` can be made more explicit

Open eddiebergman opened this issue 4 years ago • 1 comments

The typing for is_legal in HyperParameter is quite open and in general each subclass of HyperParameter is quite "open" with how it treats them, some checking for types explicitly while some rely on equivalence relation but not type, being a problem in cases like 1 == True.

Without going full generics on it which might discourage contributions I think the best solutions are:

  • Use Any as the param type and have explicit type checking via isinstance (possible performance point)
  • Have no type definition in base is_legal and each subclass can introduce its own type signature, in which case. No isinstance checks and just let whatever error bubble up as a result of user error. Likely more performany due to no type checks.

eddiebergman avatar Feb 25 '22 15:02 eddiebergman

Closed in #346

eddiebergman avatar Apr 16 '24 18:04 eddiebergman