Skip to content

Commit

Permalink
Update alns/select/MABSelector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Wouda authored Aug 3, 2023
1 parent 63a587e commit 1ad4f77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions alns/select/MABSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def __init__(
scores: List[float],
num_destroy: int,
num_repair: int,
learning_policy: LearningPolicyType,
neighborhood_policy: Optional[NeighborhoodPolicyType] = None,
learning_policy: "LearningPolicyType",

This comment has been minimized.

Copy link
@skadio

skadio Aug 3, 2023

learning question -- what's this "string" like looking typing.. It seems like a str but not a string?

This comment has been minimized.

Copy link
@N-Wouda

N-Wouda Aug 3, 2023

Author Owner

It's a string! The issue is that the Python interpreter will read all these types when parsing this function - but if mabwiser isn't installed, the types aren't available, and the interpreter would error out about these names not being defined.

That issue was fixed some years ago by this PEP, which describes delayed evaluation which will at some point become the default. That can be enabled now using from __future__ import annotations. Before that PEP, the way around this was to just define the types as strings. I used that here because then I can commit it immediately, which I couldn't do with the future import :-).

This comment has been minimized.

Copy link
@skadio

skadio Aug 3, 2023

wowza ... I just learned something new/cool 😲

(this is what you were discussing back then with Paul, which I overlooked)

This comment has been minimized.

Copy link
@N-Wouda

N-Wouda Aug 3, 2023

Author Owner

Yeah, it took a bit of work to make sure everything also works nicely when users don't have mabwiser, but we got there quickly!

neighborhood_policy: Optional["NeighborhoodPolicyType"] = None,
seed: Optional[int] = None,
op_coupling: Optional[np.ndarray] = None,
**kwargs,
Expand Down

0 comments on commit 1ad4f77

Please sign in to comment.