question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use an Enum for meas_level and meas_return

See original GitHub issue

What 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SooluThomascommented, Oct 31, 2019

I might circle back to this.

1reaction
ajavadiacommented, Jul 4, 2019

i support this as i’m often confused about whether 0 is lower or 2

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found