News for hackers. Stuff that matters.
Re:Introduction to Object Oriented Programming in Python by shackenberg on Wednesday October 24, 2018 @11:33AM (#18293275)
Can you point to any good tutorials for replacing OOP with functional patterns in Python? I often use OOP to semantically group functionality and "manage" state e.g. avoiding methods with multiple variables or cases where I have to pass one (not changing) variable to multiple functions.
Re:Introduction to Object Oriented Programming in Python by virmundi on Wednesday October 24, 2018 @12:02PM (#18293599)
Sounds like you discovered that OOP and Functional are the same thing. Closures are the poor-person's objects. Objects are the poor person's Closures. If you never mutate the internals of an Object, or mutate with copy, isn't just a coherent closure?

Checkout http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent

Re:Introduction to Object Oriented Programming in Python by shackenberg on Wednesday October 24, 2018 @12:13PM (#18293722)
If they are the same thing, why does the parent commenter prefer Functional?
Re:Introduction to Object Oriented Programming in Python by virmundi on Wednesday October 24, 2018 @12:42PM (#18294031)
Personal choice. Some people like the idea of splitting the data from the functions that operate on it. Others don't like mutability and presume that OOP requires it. Scala and other languages make it easy to have immutability and OOP. Look at Clojure. The interfaces look a lot like Object definitions.