Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is why I hate Python. The default for Python is slowness and an incompatibility with the multicore world we live in. What does it sacrifice these two first class citizens for? Shaving a few seconds off of writing types, which has also been proven to be fundamentally incompatible with team written software. Now we all get to write slow cli tools and write type annotations anyway.

I would love to see people put efficiency at the top of every requirement list. With languages like Rust you don't even have to sacrifice productivity or safety to get it.



I somewhat agree with your point, however I really believe that Python makes it possible to write FASTER and better software because it focuses on developer productivity. Just read the YouTube story.


Python is pretty speedy for its intended use case of flexible scripting, though certainly can bog down in large projects or lots of for loops.

Python puts programmer read/write efficiency at the top of the list.


Then why isn’t there a function to flatten a list in Python?

I’m not sure what Python’s priorities are, besides majorly sucking.

I can write software in Scala or OCaml or Racket in less than half the time of Python, while also being 10x faster.

Python needs to die. It’s the most worthless language I’ve ever been forced to use.


> Then why isn’t there a function to flatten a list in Python?

There's a function to flatten an arbitrary iterable into a flattened iterable and a function to turn any iterable into a list.

> I can write software in Scala or OCaml or Racket in less than half the time of Python, while also being 10x faster.

Many people, on many types of problems, find the reverse of the first relationship.


What tangible advantages does Python have compared to Racket? The only thing I can think of are the high quality data science libraries.


> why isn’t there a function to flatten a list in Python?

After a decade of writing and maintaining Python, I've never needed to flatten a list.

> can write software in Scala

I have seen projects in Scala and can't make sense of the types or data flow.

When I show non Python programmers a snippet of Python they have a good chance of getting the sense of it.


Flatten a list in Python using list comprehension

flat_list = [item for sub_list in orig_list for item in sublist ]

Using itertools

flat_list = list(itertools.chain.from_iterable(orig_list))


Yeah, of course you can flatten a list. It seems like Python programmers enjoy writing the same code over and over again.

Would it really be bad if I could just do lst.flatten ? Or flatten(lst)?


There's a case to be made that flattening a list is not a common enough operation to justify a built-in keyword or even a method on the standard library list class. The Pythonic way seems to be that if you can write something with a simple and clear one-liner then it's better and clearer to have people use that one-liner than another built-in method that people would have to go look up the implementation of.


I think you're feeding a troll here. Anyone with time enough in engineering or programming can recognize and respect these sorts of tradeoffs without trash talking least favorite tool.


I mean, you don’t believe that, do you? Maybe we should all be writing our own sorting algorithms as well.

I kind of assumed that DRY was a universally accepted principle in software engineering.

But I guess the Pythonic way is about copy and pasted code, no abstractions, wasting people’s time, egregious language inconsistencies, no multi-threading, and terrible performance.

I’ve probably written more Python than any other language, and honestly, using it feels bad. It feels outdated and useless.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: