Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumPythonclassmethod vs staticmethodSingle-choice MCQ

An alternative constructor is commonly implemented as a classmethod rather than a staticmethod. What concrete benefit does classmethod give here?

class Shape: def __init__(self, sides): self.sides = sides @classmethod def square(cls): return cls(4) class Tri(Shape): pass