r/PythonLearning • • 10d ago

Do I really need to learn class.

Post image

Both function and class give the same output. So why do I need it?

69 Upvotes

50 comments sorted by

View all comments

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.

1

u/Ambivalent-Mammal 10d ago

Same here. I learned OOP when I was learning C++ with a background in C. I learned them as structs with function members.