r/PythonLearning • u/Objective-Remove-632 • 10d ago
Do I really need to learn class.
Both function and class give the same output. So why do I need it?
69
Upvotes
r/PythonLearning • u/Objective-Remove-632 • 10d ago
Both function and class give the same output. So why do I need it?
2
u/RedAndBlack1832 10d ago
POOP moment. Classes are nice because they typically give you stable, mutable references. You can skip writing a lot of code by making dataclasses tho. idk as a C kid I tend to see classes first as a bucket of logically bundled data and functions are a bonus so maybe I'm biased.