-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduction of custom variables #199
Comments
Is there a way to iterate over the values in a Literal? I think when defining something like this globally, it would be nice to then have a way to say: With that in mind, wouldn't an Edit: Python 3.11 has |
You can easily get what you asked for using import typing
Channel = typing.Literal["x", "y", "z"]
VALID_CHANNELS = typing.get_args(Channel)
print(f"Valid channels are: {VALID_CHANNELS}") |
I did a quick scan of the codebase, found the following literals that could be typed like this:
|
Perfect. Lets leave this open and expand the list if we realize it's not complete yet. |
For PR #198, I was thinking of adding a
types.py
to define a custom variable for (gradient) channels, but I decided to create an Issue first and hear about your opinions.For (grad) channels, the custom var could simply look like this:
And of course there would be more useful custom vars, for example for labels ('SLC', 'SEG', 'REP' etc).
The advantages would be:
Let me know what you think about this.
The text was updated successfully, but these errors were encountered: