Python Forum
change dataclass to frozen at runtime
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
change dataclass to frozen at runtime
#1
I'm working with a dataclass that is code-generated by a tool I do not control:

@dataclass
class Concern:
    id: ConcernID
Note that the dataclass is not declared as frozen. I need this class to be frozen for the sake of Hashability, so I would like to modify the class at **runtime** to make it frozen. Is this possible?

thanks,

Joe
Reply


Messages In This Thread
change dataclass to frozen at runtime - by jpanico - Oct-05-2024, 07:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question how to type hint a function in a dataclass? Calab 3 973 Feb-27-2025, 04:40 AM
Last Post: Calab
  Extract args=, value that was passed to Multiprocessing.Proc object during runtime? haihal 1 714 Dec-08-2024, 07:04 AM
Last Post: Gribouillis
  class and runtime akbarza 4 1,772 Mar-16-2024, 01:32 PM
Last Post: deanhystad
  append str to list in dataclass flash77 6 3,719 Mar-14-2024, 06:26 PM
Last Post: flash77
  painfully slow runtime when handling data dadazhu 3 2,197 Jan-20-2023, 07:11 PM
Last Post: snippsat
  Big O runtime nested for loop and append yarinsh 4 3,121 Dec-31-2022, 11:50 PM
Last Post: stevendaprano
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 3,094 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Object reference in Dict - not resolved at runtime benthomson 2 2,671 Apr-02-2020, 08:50 AM
Last Post: benthomson
  PyCharm asking for VC++ runtime 14.0 whereas I have already installed VC++ 19.0 SarmadiRizvi 1 2,568 Apr-02-2020, 06:17 AM
Last Post: snippsat
  Creating a set with dataclass and dict hobbitdur 11 16,357 Jan-16-2020, 11:22 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020