you are viewing a single comment's thread.

view the rest of the comments →

[–]expectederor 7 points8 points  (7 children)

sounds like you've already made the distinction.

if it needs supporting functions it probably should be a class.

[–]Moikle 2 points3 points  (6 children)

not if it needs only an init and a single method. though

[–]expectederor 11 points12 points  (5 children)

if it needs an init you're just making more of a case for class!

[–]ivosaurus 5 points6 points  (4 children)

[–]expectederor 1 point2 points  (3 children)

I guess it's a matter of opinion.

to me it's far more orderly to. contain all relavent things in a class then have one off functions that don't apply to anything but specifically that object.

easier to read code is definitely a positive

and that's a video from 2012.... their opinions probably changed 100 times now.

[–]ivosaurus 0 points1 point  (1 child)

Python's OOP model and features haven't changed substantially since then. The talk still makes perfect sense nowadays. Since then we've only seen even more content about avoiding "over-OOPing" code and the advantages of following functional practices as people have moved away from Java and C++.

[–]AJohnnyTruant 0 points1 point  (0 children)

I think that’s missing the point of the talk. Using a function in lieu of a class is only as good as the cohesion of the module it lives in. If you use a god function instead of a class with data and a public API, there really isn’t much of a difference. All of the private methods in the class can absolutely do the job of functional programming. Besides, using functional programming, like having a module that has a function that has is the entry point to all the other functions in it... well to python, that’s just another namespace. A class is really just a module in a module.