Live data from Hacker News

Ask HN: Why Python?

news.ycombinator.com

11–20 of 22 posts

Re: Ask HN: Why Python?

#11
In my and many other developers experience and as indicated by studies, the expected number of bugs per line of code is constant and independent of the programming language. Thus, say, 400 lines of Python will contain the same number of bugs as 400 lines of C. But 400 lines of Python contains much more functionality than 400 lines of C. This is what you have been missing.

Re: Ask HN: Why Python?

#12
ecosystem + simplicity. performance matters once the time to write code that works is less than the time it runs for. and then once that gets surpassed, port the hot path into c/c++, boom.

Re: Ask HN: Why Python?

#13
Thanks to Numba, you can even JIT python to native machine code and gain 10 - 30x performance boost. And you can even compile the code to CUDA GPU code! Pretty cool to do that in python, rather than in a C dialect.

Re: Ask HN: Why Python?

#14
post #9
post #4

> Like I can use Node, Go, C#, and Java at scale without being concerned about the low-level details, however, that's not the case for Python. Well, if you chose not be concerned about the low-level details with these languages, then you can chose not to be concerned about the low-level details with Python. There's nothing inherent in Python or those other languages that makes it otherwise. Or you mean "but Python is…

> Ease of use, less ceremony, huge package ecosystem including several de-facto standards for many use cases/industries, suitable for glue work, are benefits. Sure, these are operational advantages. But purely from an computational perspective (GPUs, multi-core, concurrency, etc) does it offer anything natively without interfacing with C/C++ that validates it to be called a general purpose language.

>But purely from an computational perspective (GPUs, multi-core, concurrency, etc)

Most of the stuff people do with Python isn't hampered by the "computational perspective". For the things that are, we usually don't need to interface with C/C++, because somebody else has already written the library that does it.

Re: Ask HN: Why Python?

#15
I got into Python from C/C++ for data plumbing in the late 2000s, before data science / ML really took off.

I think much of what appeals to me comes in three camps:

One: "Zen of Python" philosophy. The idea of both explicitness and being "exactly one way of doing things" helps with menial tasks I don't want to think too deeply about. Maybe I _shouldnt_ think too deeply about how I move some files around, parse JSON, or hit an API.

Two: Batteries included. The standard library has always been extensive and "just works" in ways other language ecosystems have long struggled to catch up to. Especially for data / file plumbing tasks. It's also not very complicated to do most simple things in without a 3rd party library.

Three: C integration. Writing native C modules seems to have been baked into the language from day one which has led IMO to much of the data science ecosystem. The ecosystem seemed to connect with the practical, old-school C programmer part of my brain, and make a lot of sense from a perspective of "get shit done" imperative programming style.

One maybe critique -

I think the nature of Python, and how people historically approached it, can lend to a kind of lazy/bad software engineering.

People historically had gotten into Python because of dumb scripts, and not because they care to think deeply about how code SHOULD be structured. Python's practicality is a bit in contrast with the culture of Ruby where aesthetics are highly prized. So a criticism of Python could be its very easy to get started with a dumb script, to solve a practical problem, that eventually becomes a critically important project. Unfortunately everyone just focusing on "getting the next thing done" means it can morph into unmaintainable spaghetti mess because its some side thing.

I don't know if that's the languages fault per-se, or just a side effect of the "lack of ceremony" needed to do work. Certainly, you can and should have high software engineering standards for your Python project. Just something I've observed perhaps as Python itself can often be a "side" thing, not the primary focus of practitioners.

Re: Ask HN: Why Python?

#16
post #2

You bring up a valid question. The value of Python as a general-purpose programming language comes from a variety of its attributes. Readability and Simplicity: Python was designed to emphasize readability and simplicity, making it an excellent language for beginners and for prototyping complex systems. This simplicity means developers can spend less time understanding the code and more time creating functional eleme…

> emphasize readability

This is a claim that has never, ever been true.

Nothing is less readable than defining scope with whitespace. Nothing.

One really has to boggle at the notion that there are people who consider Python (or YAML for that matter) even remotely readable.

Re: Ask HN: Why Python?

#17
You can't use Java at scale without worrying about the low level details (e.g. performance). So in a sense python is in the same club as java.

I don't understand the need for python either. I've built data processing and visualization tools in C++ and prefer to do that so I am aware of the performance implications. With python you still need to be aware of what happens under the hood, but then you also need to learn the syntax and identation, so it's like you have multiple jobs. Why not learn C or C++ and use that? There are endless libraries you can use. AFAIK anything that exists for python can be used from C or C++.

It's especially puzzling when getting to a coding interview and the person only knows python and doesn't understand why you never had the need for pandas or any other python specific libraries.

I'm wondering if python hasn't been pushed such that more coder drones can be created easily which makes it easier to hire people and pay them less.

Re: Ask HN: Why Python?

#18
post #2

You bring up a valid question. The value of Python as a general-purpose programming language comes from a variety of its attributes. Readability and Simplicity: Python was designed to emphasize readability and simplicity, making it an excellent language for beginners and for prototyping complex systems. This simplicity means developers can spend less time understanding the code and more time creating functional eleme…

Good points. with arrival of MOJO, we can probably keep all the benefits of python but also getting great performace. And then perhaps MOJO python will be used everywhere.

Re: Ask HN: Why Python?

#19
Python was favored by universities, professors and the like a long time ago. Maybe it just had this academic feel to it.

This is even why it started to pick up in AI / ML / etc space. Some students that used it during class may also carry on with it.

It was also common for sysadmins before Go took over. A lot of the earlier tools were Python based.

Usually languages are created by people and because people like it.

Re: Ask HN: Why Python?

#20
post #19

Python was favored by universities, professors and the like a long time ago. Maybe it just had this academic feel to it. This is even why it started to pick up in AI / ML / etc space. Some students that used it during class may also carry on with it. It was also common for sysadmins before Go took over. A lot of the earlier tools were Python based. Usually languages are created by people and because people like it.

Can you please give me examples on what Go took from a Python? Just looking to see if I can gain something from learning Go.
Post reply on HN