Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [enums]

A data type consisting of a set of named values called elements, members or enumerators of the type.

enums
0 votes
1 answer
15 views

Is it possible to define a macro that checks if a value falls within value range for any given sequential enum?

Given an enum which is assigned sequentially (i.e. the first value is 0 and the last value is the number of enumerations - 1), we can check if a value is a valid enum value like so: enum e {FOO, BAR, ...
You'reNotARobot's user avatar
4 votes
1 answer
32 views

converting list of Str into list of Enums

I have an enum definition in a module AAA: enum RDProcDebug <None All AstBlock BlockType Scoping Templates MarkUp>; class Debug { method foo(RDProcDebug @ds) { for @ds { say .key ~ ' =>...
Richard Hainsworth's user avatar
0 votes
0 answers
19 views

How can I make typing.overload work with enum.Enum? [duplicate]

typing.overload decorator type-hints don't seem to work with enum.Enum I have a class that with a method called 'get_component'. This method should return the component that has a matching ID to the ...
Brett Dean's user avatar
0 votes
0 answers
17 views

STM CUBE IDE ENUM issue

I create a Enum table in the STM32 CUBE IDE V1.8 and I have about 160 index's within, when I program my STM32 and enter Debug mode, the index after number 127 obtains the value -128 followed by -127,-...
Teague Thomas's user avatar
-1 votes
0 answers
39 views

SWIG (C++ to Java) problem with including same headers from different modules

I got example header Shape.h with 2 enums like: enum ShapeType { ShapeTypeRect, ShapeTypeCirle, ShapeTypeDefault, }; enum ShapeStyle { ShapeStyleSolid, ShapeStyleDashed, ...
AnDevi's user avatar
  • 79
1 vote
3 answers
105 views

Multithreaded Access on C Enum

I've found out that in C-Language a Enum is usually considered 4 Bytes. If I have a multithreaded Application using a enum variable it might (even on 32-bit Processors) not be a atomic access, meaning ...
Valentin Weiß's user avatar
1 vote
1 answer
47 views

_Generic Statement For An Enumerator (Enum)?

I frequently have to deal with the functionality of enums in C. However, there doesn't seem to be an easy & equally efficient way of supplying a different result based off of a predefined enum ...
Zenais's user avatar
  • 108
0 votes
0 answers
16 views

Strapi enum values change based some value

Is it possible in strapi to set different enums based some value? I want to change my enums list based my exercise type, because I want to others who used admin panel for menage exercise data will ...
Mee's user avatar
  • 43
1 vote
2 answers
95 views

How to make argparse work nicely with enums and default values?

I have an enum: from enum import auto, Enum class MyEnum(Enum): ONE = auto() TWO = auto() THREE = auto() and I want to use it as an argument with argparse. To be more specific, I want to ...
Shai Avr's user avatar
  • 1,220
1 vote
0 answers
35 views

Dataclass Enum init item from another item

I'm trying to make an Enum the values of which are of a type which is a dataclass. As per the official Python Enum HOWTO, this can be achieved by inheriting from both Enum and the base dataclass. Ok, ...
bbudescu's user avatar
  • 333
1 vote
1 answer
61 views

Detect nullable enum type in source generator

I'm writing a source generator that processes my model classes and adds some custom serialisation code for them. The model classes can have all sorts of property types. I'm currently interested in the ...
ygoe's user avatar
  • 19.8k
0 votes
1 answer
15 views

Is there a way to "expand" an enum in C++ for "type-switching"?

For a project I need an observer class (owned by a Subject that then notifies all of its observers) that handles other behaviours. These observers work by calling their onNotify( Event* ) method that ...
thegrult's user avatar
0 votes
0 answers
21 views

Kotlin/JS exhaustivity check on enums?

I am investigating into the integration of a Kotlin Multiplatform library into an existing JS project. I am struggling with the exhaustivity check on enums and sealed classes on the JS side. In JS, an ...
Ricola's user avatar
  • 2,844
3 votes
2 answers
55 views

the values of ENUM type in SQLAlchemy with PostgreSQL is the variable not the value?

so my problem is i am trying to make an enum with int values but it didn't work. first of all, this is the code. class UserRole(enum.IntEnum): publisher = 4 editor = 3 manager = 2 ...
ibrahim shazly's user avatar
1 vote
0 answers
12 views

Python Enum : achieve multiple attributes with IntelliSense through code generation (jinja2)

CONTEXT My project is about implementing the "conventional method for house-energy-efficiency assessment" in France (120 pages). This method, comes with a huge .xls file providing definition ...
Lionel du Peloux's user avatar

15 30 50 per page
1
2 3 4 5
1511