Use an Enum for meas_level and meas_return
See original GitHub issueWhat is the expected enhancement?
meas_level seems to be the perfect candidate for an Enum class. The change would improve readability and clarity around raw numbers in the code. For instance: meas_level=MeasLevel.CLASSIFY is more suggestive of turning readout results into classified {0,1} bits than meas_level=2. This also fits with most other leveling systems in python, such as logging levels (https://docs.python.org/3/library/logging.html#levels). This could also apply for meas_return.
My proposal:
class MeasLevel(Enum):
RAW = 0
KERNELED = 1
CLASSIFIED = 2
class MeasReturn(Enum):
SINGLE = "single"
AVG = "avg"
I’d love any recommendations for the meas_level names.
Likely this would induce another change further down the line to pull .value out.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Enumeration types - C# reference - Microsoft Learn
You use an enumeration type to represent a choice from a set of mutually exclusive values or a combination of choices.
Read more >Enum Types - Java™ Tutorials
An enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must...
Read more >enum — Support for enumerations — Python 3.11.1 ...
Base class for creating enumerated constants that can be combined using the bitwise operators without losing their IntFlag membership.
Read more >How to enumerate an enum? - Stack Overflow
Then if you have duplicates/synonyms in your enum, and you want the other behavior, you can use Linq's Distinct extension (since .NET 3.5),...
Read more >Handbook - Enums - TypeScript
We'll first start off with numeric enums, which are probably more familiar if you're coming from other languages. An enum can be defined...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I might circle back to this.
i support this as i’m often confused about whether 0 is lower or 2