Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Immutable Data Classes

Avatar image for NIRMAL JAIN

NIRMAL JAIN on Sept. 27, 2025

Why does frozen and order parameter don’t work together for dataclass

Avatar image for Bartosz Zaczyński

Bartosz Zaczyński RP Team on Sept. 27, 2025

@Nirmal Jain You can combine the two just fine:

>>> from dataclasses import dataclass
>>> @dataclass(frozen=True, order=True)
... class Point:
...     x: int
...     y: int
... 
>>> Point(1, 2)
Point(x=1, y=2)

Become a Member to join the conversation.