OK, this may be a dumb question but I'll ask anyway. I am starting to see the benefits of using classes. Most notably code reuse, inheritance and overloading. Shoud I still be writing fuctions in my scripts or do classes make them obsolete? Is there a rule of thumb that if your script has say 20 lines or more you should write a class?
ccandillo
0
Newbie Poster
Recommended Answers
Jump to PostClasses don't make functions obsolete. The beauty of Python is that you can go either way. It's up to you, if a class makes sense, use it. I use classes in most GUI programs, using inheritance is very common. Also, the program looks more organized and simply makes life easier.
All 4 Replies
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
woooee
814
Nearly a Posting Maven
lllllIllIlllI
178
Veteran Poster
Stefano Mtangoo
455
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.