News for hackers. Stuff that matters.
Re:Introduction to Object Oriented Programming in Python by goatlover on Wednesday October 24, 2018 @11:51AM (#18293466)
Why not just use Haskell? Python has OOP baked into the language. Also, your responding to an article on introducing OOP with how not to use OOP, which seems tangental and deserving of it's own thread.
Re:Introduction to Object Oriented Programming in Python by mavelikara on Wednesday October 24, 2018 @12:01PM (#18293583)
+1. When GP leaves a job and a "Python Programmer" is hired to replace him/her, their life will be hell. At that point one can only hope that GPs next gig is at a Haskell shop where every single function returns an IO action :)
Re:Introduction to Object Oriented Programming in Python by ilovecaching on Wednesday October 24, 2018 @12:50PM (#18294119)
In my experience what matters is the quality of the code regardless of the paradigm used. A well written piece of functional Python with comments and documentation will be much easier to understand than poorly written OOP.

FP is also quite idiomatic. Pythons list comprehensions are quite powerful, and the libraries I mentioned in my previous comment are all part of the standard library. There are third party libraries that attempt to make Python even more functional.

Re:Introduction to Object Oriented Programming in Python by olavk on Wednesday October 24, 2018 @01:51PM (#18294714)
Well written code is obviously better than badly written code. But why assume the functional-style is better written than the idiomatic Python? I think a good developer understand the context they work in rather than try to fit a square peg in a round hole.

I wouldn't like to maintain Haskell code written by someone who thinks everything should look like Python. And vice-versa.

Re:Introduction to Object Oriented Programming in Python by tarboreus on Thursday October 25, 2018 @11:56AM (#18301888)
Python code doesn't have to be OOP to be idiomatic. That said, functional code that uses lambdas, map, etc. is generally not idiomatic Python. I've seen a lot get done just with functions, list comprehensions, and Python-specific magic without using OOP, though. Guess that's mostly just imperative on steroids, though.
Re:Introduction to Object Oriented Programming in Python by ilovecaching on Wednesday October 24, 2018 @02:19PM (#18294961)
> square peg in a round hole

Python is a multi-paradigm language. I have not found Python to be better at OOP versus imperative or functional styles of programming.

For me, functional programming provides a closer to model to how I think about problems. This is true for many people. One should choose the style that provides the easiest translation of thought to code.

Re:Introduction to Object Oriented Programming in Python by olavk on Wednesday October 24, 2018 @02:48PM (#18295238)
If you only write code which you yourself will read and maintain, then you should definitely do whatever you feel works best for you and matches your way of thinking.
Re:Introduction to Object Oriented Programming in Python by wrmsr on Wednesday October 24, 2018 @04:13PM (#18295927)
Python's lambda is very intentionally limited precisely to steer people away from overly functional code. Don't write Haskell in Python, and equally don't write Java in Python.
Re:Introduction to Object Oriented Programming in Python by rptr_87 on Thursday October 25, 2018 @04:52AM (#18299460)
I’m currently working on a large C++ project... which has layers and layers of indirections...

It’s so hard to even check where the actual implementation is....

There are no comments in code, no documentation whatsoever...

Re:Introduction to Object Oriented Programming in Python by goatlover on Wednesday October 24, 2018 @12:10PM (#18293687)
Using a programming language idiomatically is better than using it to match one's preferred paradigm. If the paradigm is more important, then use the right tool for the job. My understanding is that Guido and the community never intended Python to be a functional PL.
Re:Introduction to Object Oriented Programming in Python by cgopalan on Wednesday October 24, 2018 @12:16PM (#18293761)
IMHO, Python has enough functional goodies to accomplish a lot with just functions and provided datastructures. I only use OOP as a technique to address specific issues, rather than treat it as something fundamental as writing functions.
Re:Introduction to Object Oriented Programming in Python by yen223 on Wednesday October 24, 2018 @05:02PM (#18296356)
As a Python developer, I'd much rather maintain a system written in a functional style, over one written in a Java-like OO style.

Refential transparency and simple data structures makes code much simpler to understand, and leads to fewer surprises when the code is being modified.

Re:Introduction to Object Oriented Programming in Python by ilovecaching on Wednesday October 24, 2018 @12:46PM (#18294072)
Python is one of the most popular languages in the world, it’s quite common to encounter it when you join a new buisness. It’s also the language many people learn to program with (I did).

Anyone who learns Python will necessarily learn OOP as it’s the de facto style. The post is a resource for that. My comment is meant to encourage people to consider the alternative ways you can approach problems in Python.