AI engineering glossary · Python advanced
What is class method?
Class method (also called @classmethod): A method bound to the class instead of an object, marked with @classmethod and receiving the class as its first argument (usually cls). It is often used as an alternative constructor.
Class method: an example
@classmethod def from_csv(cls, path): return cls(read(path)) builds an object from a file, e.g. Dataset.from_csv('sales.csv').
Related terms
More Python advanced terms
Where you learn it
Class method is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.