add Enum to immutable types#5808
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR adds Python's Enum class to the IMMUTABLE_TYPES constant in reflex/utils/types.py. The change involves importing the Enum class and adding it to the tuple of immutable types that Reflex uses to classify values.
The modification is straightforward and addresses a gap in the type system. Python enums are inherently immutable - once created, enum members cannot be modified and are implemented as singletons. This immutability makes them suitable for inclusion in the IMMUTABLE_TYPES constant, which is used by the is_immutable() function to determine whether values can be safely treated as immutable.
This change fits naturally into Reflex's type classification system, which is used throughout the framework for state management, serialization, and other operations that need to distinguish between mutable and immutable data. The IMMUTABLE_TYPES constant already includes other immutable Python types like int, float, bool, str, bytes, frozenset, tuple, and type(None), so adding Enum completes this list with another fundamental immutable type.
Confidence score: 5/5
- This PR is safe to merge with minimal risk
- Score reflects a simple, correct addition of a genuinely immutable type to an existing constant
- No files require special attention
1 file reviewed, no comments
masenf
left a comment
There was a problem hiding this comment.
makes sense to me; @adhami3310 what do you think?
CodSpeed Performance ReportMerging #5808 will not alter performanceComparing Summary
|
|
some enums can be of mutable type, but it should be alr |
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
After these steps, you're ready to open a pull request.