TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why Python?

15 pointsby itsmefazalmost 2 years ago
I am not looking to be controversial. It is something I have been genuinely thinking for sometime.<p>I don&#x27;t understand the need for Python as a general-purpose programming language. How are organizations using Python at scale? I understand that it is a good scripting language but other than does it offer anything substantial compared to other general-purpose languages like - Node, Go, C# or even Java? These languages can also be used at scale without worrying about the low-level details, however, I cannot say the same for Python.<p>Apart from AI &#x2F; ML, where Python is heavily used by interfacing with C&#x2F;C++&#x2F;CUDA libraries is there any place where Python stands out on its own without merely acts as a frontend to other languages?<p>Am I missing something here?

12 comments

bjournealmost 2 years ago
In my and many other developers experience and as indicated by studies, the expected number of bugs per line of code is constant and <i>independent of the programming language</i>. 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.
coldteaalmost 2 years ago
&gt;<i>Like I can use Node, Go, C#, and Java at scale without being concerned about the low-level details, however, that&#x27;s not the case for Python.</i><p>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&#x27;s nothing inherent in Python or those other languages that makes it otherwise.<p>Or you mean &quot;but Python is slow&quot;? That&#x27;s mostly irrelevant for many use cases, which either don&#x27;t need the speed (web, administration, glue, controllers, etc), or depend on Python packages written in C&#x2F;Fortran and plenty fast (which is the case for AI &#x2F; ML &#x2F; DS and such).<p>&gt;<i>it doesn&#x27;t seem to offer any benefits compared to Node, Go, C# or even Java</i><p>Ease of use, less ceremony, huge package ecosystem including several de-facto standards for many use cases&#x2F;industries, suitable for glue work, <i>are</i> benefits.
评论 #36461657 未加载
ubermanalmost 2 years ago
Python is easy to use and easy to start programming in. Much easier than the other alternatives you mention. This from a guy who uses python but does not particularly care for it. I love me some curly braces and hate significant whitespace but there is no getting around the ease of teaching in python and its beginner friendliness.<p>Why cant you use python at scale? Many ML&#x2F;AI&#x2F;Data tasks are exceedingly resource intensive but python still plays in thoses spaces as you elude to.<p>Are people writing realtime systems in python? Probably not but dont be quick to dismiss python before you know it is not performant enough for your use case.<p>I&#x27;m not saying python is the best choice, but it is often the easiest choice.
评论 #36497193 未加载
itsmefazalmost 2 years ago
Author here! I have finally come to realize why and where Python is required.<p>- Python is a fantastic frontend (glue) language that interop well with C&#x2F;C++ libraries. This seamless binding is not natively available in languages in Go or Java or even JS.<p>- Python has an excellent data science &#x2F; modelling &#x2F; data engineering &#x2F; ml ecosystem. There is no other language that comes close.<p>- Python is a fantastic MVP language. One can rapidly prototype and iterate and to a very good extend scale a product.
re-thcalmost 2 years ago
Python was favored by universities, professors and the like a long time ago. Maybe it just had this academic feel to it.<p>This is even why it started to pick up in AI &#x2F; ML &#x2F; etc space. Some students that used it during class may also carry on with it.<p>It was also common for sysadmins before Go took over. A lot of the earlier tools were Python based.<p>Usually languages are created by people and because people like it.
评论 #36488666 未加载
b20000almost 2 years ago
You can&#x27;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.<p>I don&#x27;t understand the need for python either. I&#x27;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&#x27;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++.<p>It&#x27;s especially puzzling when getting to a coding interview and the person only knows python and doesn&#x27;t understand why you never had the need for pandas or any other python specific libraries.<p>I&#x27;m wondering if python hasn&#x27;t been pushed such that more coder drones can be created easily which makes it easier to hire people and pay them less.
jleyankalmost 2 years ago
There are advantages working in an interpretive (scripting) language and there are several science applications that use Python as the top level control language and a c-like language as the heavy lifting code. This plays to the strength of each language and casual users can use the complex functionality without looking at the complex code.
softwaredougalmost 2 years ago
I got into Python from C&#x2F;C++ for data plumbing in the late 2000s, before data science &#x2F; ML really took off.<p>I think much of what appeals to me comes in three camps:<p>One: &quot;Zen of Python&quot; philosophy. The idea of both explicitness and being &quot;exactly one way of doing things&quot; helps with menial tasks I don&#x27;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.<p>Two: Batteries included. The standard library has always been extensive and &quot;just works&quot; in ways other language ecosystems have long struggled to catch up to. Especially for data &#x2F; file plumbing tasks. It&#x27;s also not very complicated to do most simple things in without a 3rd party library.<p>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 &quot;get shit done&quot; imperative programming style.<p>One maybe critique -<p>I think the nature of Python, and how people historically approached it, can lend to a kind of lazy&#x2F;bad software engineering.<p>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&#x27;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 &quot;getting the next thing done&quot; means it can morph into unmaintainable spaghetti mess because its some side thing.<p>I don&#x27;t know if that&#x27;s the languages fault per-se, or just a side effect of the &quot;lack of ceremony&quot; needed to do work. Certainly, you can and should have high software engineering standards for your Python project. Just something I&#x27;ve observed perhaps as Python itself can often be a &quot;side&quot; thing, not the primary focus of practitioners.
pizzaalmost 2 years ago
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&#x2F;c++, boom.
nikonyrhalmost 2 years ago
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.
detaroalmost 2 years ago
&gt; <i>however, that&#x27;s not the case for Python</i><p>in what way?
评论 #36461625 未加载
gigmanaalmost 2 years ago
You bring up a valid question. The value of Python as a general-purpose programming language comes from a variety of its attributes.<p>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 elements. Even experienced programmers appreciate Python for its simplicity and how it encourages good programming style.<p>Wide Range of Libraries: While you mentioned AI&#x2F;ML&#x2F;Data, it&#x27;s worth noting that Python&#x27;s rich set of libraries (both built-in and third-party) makes it useful for a massive array of tasks beyond just those fields. It has powerful libraries for web development (Django, Flask), data manipulation (Pandas), image processing (PIL, OpenCV), GUI development (Tkinter, PyQt), and many others. This versatility allows Python to be used in many different problem domains.<p>Glue Language: Python is also often used as a &quot;glue&quot; language to connect different components of an application. Since it&#x27;s easy to interface with C&#x2F;C++, it can be used to control and orchestrate low-level modules while providing a high-level interface to the user.<p>Automation and Scripting: Python&#x27;s simplicity and wide range of libraries make it a popular choice for automating tasks, which is a large part of what any scaled system needs to handle. These tasks range from managing file and directory operations to web scraping or interacting with network resources.<p>Testing: Python is often used in the development environment for testing other code. Its simplicity allows for writing tests quickly, and its wide range of libraries allows for testing various programs.<p>Education and Research: Python is also widely used in education and research due to its ease of learning and wide range of applications. As these researchers move into industry, they often continue to use the tools they are most comfortable with.<p>In terms of using Python at scale, Python&#x27;s indeed interpreted nature and Global Interpreter Lock (GIL) can limit its performance in some scenarios compared to compiled languages. However, many organizations find that Python&#x27;s benefits outweigh these costs, especially when the limitations can be mitigated. For instance, using Python as a high-level interface to low-level modules written in C&#x2F;C++, or using multiprocessing to take advantage of multiple cores and systems.<p>So while it&#x27;s true that Python might not be the best choice for every situation (for instance, real-time systems, high-performance computing, or mobile app development), it&#x27;s a powerful tool with a wide range of uses that many organizations find valuable. Different programming languages often have different strengths and weaknesses, and the best language to use often depends on the specific needs and constraints of the project.
评论 #36468198 未加载
评论 #36475195 未加载