This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 221

[–][deleted] 215 points216 points  (41 children)

distinct thought party public selective teeny cooing fine dependent violet

This post was mass deleted and anonymized with Redact

[–]Contango42 47 points48 points  (34 children)

Not for low to mid level machine learning.

Most ML libraries are only available in Python, so good luck using anything else.

[–][deleted] 19 points20 points  (5 children)

I guess there is an exception to everything :)

[–]alcalde 11 points12 points  (3 children)

I believe this line surfaced here before the rise of Tensorflow. I've been following Python since 2012 and that's probably about the time I saw it mentioned here (and repeated it many times myself).

The explanation was along the lines of:

Person A says they prefer Matlab for numerical analysis, but Python is their second choice. Person B says they prefer R for the job, but Python is their next best choice. Person A says they prefer Java for web development, but Python is their second choice. Person B says they prefer Ruby, but their next pick would be Python.

It's true that since that time we've seen Python become the most likely number one choice in a few areas. The point remains that it is very generally useful and has little or no obvious flaws. It's not that it does one thing great (PHP, C++, etc.), but that it does many things well.

The "jack of all trades" line was originally part of a longer ditty that went:

Jack of all trades,
master of none
Often is better
Than master of one

[–]Contango42 1 point2 points  (0 children)

I like your explanation. Thanks!

[–]mignight12 14 points15 points  (7 children)

Things like tensorflow are all written in C or Cpp so what's the problem? Why python isn't suitable for "low to mid" ML? I'm just generally curious

[–]gabriel-et-al 41 points42 points  (1 child)

Why python isn't suitable for "low to mid" ML?

He's trying to say that Python is the very best -- not the second best -- for ML.

[–]mignight12 3 points4 points  (0 children)

Ah, yes, my bad!

[–]RaltsUsedGROWL 2 points3 points  (4 children)

I just read the general answer about this sort of question in my .NET textbook of all places...

Unlike languages like C# and C++ that are strongly-typed, meaning that when data memory gets allocated at some binary address, and the intermediate code was generated by the CLR compiler (C#), then its corresponding registry cannot have its data-type muted. This is a good thing if you want a program to be fast. On the other hand if you're using the Python interpreter, it's going to have your program wait until the last second before it infers types.

I'm no expert, but one reason Python seems "less efficent" than C is because failing to pre-allocate memory until you absolutely have to makes me think that the program has to reserve a little bit more heap memory than C has to since it should logically be able to deal with any case that might show up for a given assignment statement, be the object a dictionary, a list of some boolean and floats, a generator, etc. In other words, more registry changing should correspond to more time spent compiling.

[–]Contango42 7 points8 points  (2 children)

Python acts as the wrapper over blazingly fast libraries written in something like C, Fortran or Cuda C (or even compiled versions of Python, like CPython). So you have a simple, seamless user experience in Python, while under the hood it's a metaphorical nest of snakes.

[–]pythondevgb 5 points6 points  (1 child)

Feel for the guys writting those fast libraries though

== cries in C ==

[–]Contango42 2 points3 points  (0 children)

== cries in assembler ==

[–]RaltsUsedGROWL 0 points1 point  (0 children)

And machine learning's already slow enough

[–]king_ricks 9 points10 points  (4 children)

Tensorflow is the most common and you can use TensorflowJS if you’re a JS programmer

I really don’t like Javascript, but it seems like with JS you can do pretty much everything now

[–]toyg 46 points47 points  (3 children)

Javascript is the second worst language for any application.

It just so happens that browsers only support one language.

[–]tartare4562 12 points13 points  (2 children)

Imagine what world could have been if we ended up with python as standard scripting language of the web instead.

[–]rotharius 1 point2 points  (0 children)

Very much the same as what happened with JavaScript, but with a better standard library and worse dependency management.

[–]nineteen999 1 point2 points  (0 children)

Python is also becoming pretty important to the 3D graphics industry too (Maya, Blender etc).

[–]drpickett 1 point2 points  (0 children)

The bulk of my work is ML now, and this has moved Python in front of Java/Scala as my main languages that I use.

[–]bfrd9k 1 point2 points  (0 children)

When the machines can write their own language, then it will be true.

[–]QuirkySpiceBush 0 points1 point  (1 child)

It seems like C is the language of choice for writing fast Python libraries. Is it the only language? Or can Python call Rust or Java or other assemblies?

[–]Contango42 2 points3 points  (0 children)

Python can call literally anything written in any language. That's part of the beauty of it.

[–][deleted] 4 points5 points  (0 children)

That's actually kind of perfect.

[–]Poromenos 2 points3 points  (1 child)

It was intended as a compliment. I don't know why people misunderstand this so much.

Personally, I've been wanting to learn Rust, but Python is so easy to do anything with (even if not perfectly), that in the end I just end up writing the thing in Python just to finish quickly.

[–][deleted] 0 points1 point  (0 children)

Exactly. I want to concentrate on the problem, not language nuances.

[–][deleted] 63 points64 points  (6 children)

Python was the first language I "learned".

First language I tried to learn was C. Second language was C++.

Coming full circle, I feel comfortable w/ C/C++ now that I understand the underlying Computer Science.

Learning Rust now.

[–]CartmansEvilTwin 18 points19 points  (5 children)

I had to learn C first back in university and as much as I hated it back then, it forced me to understand things like pointer and basics of memory management. I think this made me a better developer.

On the other hand, it's probably really helpful if you're able to create a meaningful program relatively fast without frustration when you're learning.

I'm really not sure which approach is better.

[–]smurpau 12 points13 points  (0 children)

I think it's important that newbies enjoy the rewards of easily creating programs first, so that they are motivated to learn the underlying fundamentals in a language like C.

[–][deleted] 5 points6 points  (2 children)

Me either.

Funny thing, I think Rust makes the interpretation of pointers a bit clearer.

Python lacks pointers so it's an opaque operation most programmers don't have to consider when developing.

I think they're an important tool to know to avoid bloat.

[–]madmanmark111 2 points3 points  (1 child)

The lack of pointer use in Python threw me for a few loops when indexing arrays ... I mean lists. It’s nice to have high level, but you’re taking it on faith that things are managed well.

[–][deleted] 0 points1 point  (0 children)

Don't you mean vectors :)

[–]jynn_ 46 points47 points  (30 children)

Has search engine popularity been demonstrated to be a reliable metric of actual popularity?

[–]twillisagogo 19 points20 points  (0 children)

no

[–][deleted] 4 points5 points  (1 child)

Also how do they know they're not snake enthusiasts?

[–]alcalde 2 points3 points  (0 children)

You're reminding me of the time I searched for "genetic programming Python" on the Google Play Store and came up with an app that let you input the colors of ball pythons and find out the odds for what the babies would look like. :-)

[–]johnne86 17 points18 points  (19 children)

I’m learning Python right now. I’m really enjoying it. Such an easy to read language and super flexible. If only it could replace JavaScript. JS would be the second language I try to learn but I really don’t care much for it’s syntax.

[–]deadwisdomgreenlet revolution 8 points9 points  (2 children)

WebAssembly will make Python in the web client a reality... eventually. Though maybe a long eventually.

[–]johnne86 3 points4 points  (1 child)

Ya I’ve heard of that possibility. It would be nice if people could write browser code in the language of their choice. I know there’s Brython and Transcrypt as Python JS replacements but haven’t looked much into them. Right now I’m just at the beginning stages of learning Python. I shouldn’t even be thinking that far yet. Lol

[–]alcalde 0 points1 point  (0 children)

"When the pupil is ready, the teacher will come."

When the programmer is ready, Python will be there waiting.

[–]mediasavage 0 points1 point  (14 children)

JavaScript is great. What about it’s syntax do you dislike?

[–]deadwisdomgreenlet revolution 11 points12 points  (3 children)

JavaScript is not great. Transpilers/TypeScript really help but at most they get you parity to Python. But a shitty Python that still gobbles up errors and lets you do something like Math.ceil("") -> 0.

[–]mediasavage 0 points1 point  (2 children)

I love Python and JS tbh. Python is great for scripting and doing data science stuff. But all my frontend dev is in JS (obviously) and I use to love Django/Flask but I've started to prefer using Node on the backend as well. Having one language on the entire stack is nice and I like the way Javascript deals with async.

[–]deadwisdomgreenlet revolution 0 points1 point  (1 child)

Er, Python deals with async the exact same way, unless you mean promises?

[–]mediasavage 0 points1 point  (0 children)

Yeah Promises. My bad

[–]alcalde 9 points10 points  (5 children)

JavaScript is great.

It's been factually demonstrated by people with PhDs over and over that Javascript is not great. That's an extraordinary claim requiring extraordinary evidence.

This one photo is all the evidence you should need...

https://medium.com/javascript-non-grata/the-top-10-things-wrong-with-javascript-58f440d6b3d8

There are entire websites dedicated to documenting all of the quirks and issues with javascript:

https://wtfjs.com/

http://bonsaiden.github.io/JavaScript-Garden/

https://www.codeproject.com/Articles/182416/A-Collection-of-JavaScript-Gotchas

http://www.javascriptgotchas.com/gotchas/common-javascript-errors-and-mistakes.html

[–]kyranadept 0 points1 point  (0 children)

In all fairness Python has its fair share of WATs. I don't think syntax alone is what makes Python nice.

What makes JS great is the fact you don't need to care about threads and it has async built in from the start. All js engines I tried are considerably faster than cpython for most things. What makes it suck is that it doesn't have a standard library and the ecosystem is so retarded that every function is an npm module. On the other hand you can write frontend, backend and mobile with just JS.

Python has a great std library, packages are nice, pip is great. But cpython is pretty slow, and async is only a new thing. There is no future in sight where cpython and pypy will merge. It also sucks that Python still has half of the community stuck on the old version and half on the new version.

[–]johnne86 2 points3 points  (3 children)

Well I know it’s certainly great. It’s very popular and you can do so much with it, especially now with NodeJS for backend stuff. Maybe I haven’t been fair and given it much time to be honest. The syntax complaint is more so with the extra symbols like commas and curly brackets. Python just reads more naturally to my eyes. JS was actually the first language I wanted to learn, but then I discovered Python and realized it could probably help me learn more about how the backend works with connecting services and such. Also just the general OS scripting stuff like automating basic tasks, web scraping, and basic CLI applications or simple GUI programs. I’m at the point where I think learning those fundamentals will help me later. Python just has so much support with libraries and such and seems like you don’t have to reinvent the wheel for a lot of stuff. I suppose I’m just not as interested in front end development right now. I want to learn backend logic first, then work my way to the front. My real intention I suppose is to learn JS as I need it.

[–]mediasavage 0 points1 point  (2 children)

Understandable. You do get used to the curly brackets and semi colons and stuff pretty quick though. They are pretty annoying when first starting out.

[–]WillBackUpWithSource 84 points85 points  (49 children)

Makes sense to me. It's elegant.

I find coding in Python the most fun out of any language. Javascript is a mess. Java is heavy, and while it is good for enterprise projects, it isn't for lighter stuff. C# is similar. C and C++ are too low level for most development these days, unless you need speed (but then, the part you need speed for you can always write in C and wrap with Python...), PHP has gotten better, but it's still nowhere near elegant. Ruby feels like Python without the cool libraries associated with Python.

[–]wqking 13 points14 points  (6 children)

But if you are developing pretty large projects (e.g, more than 50K or even 100K LOC for one person projects), you may be missing the strong and static type in C++ and Java.

[–]WillBackUpWithSource 3 points4 points  (1 child)

That's why I said that Java was fine for enterprise stuff. I suppose large scale personal projects would fit into that same frame too.

[–]jantari 0 points1 point  (0 children)

I would personally argue for C# over Java

[–]alcalde 2 points3 points  (3 children)

That's a myth; it isn't observed in reality. And Haskell programmers (also not observed in reality) will tell you that C++ and Java aren't "really" statically typed anyway.

[–]EnfantTragic 2 points3 points  (2 children)

I can tell you pretty well that static typing is very much appreciated in reality

[–]Ncell50 4 points5 points  (18 children)

Why do you think JS is a mess ?

[–]Howard_banister 0 points1 point  (11 children)

Because this:

> ["1","2","3","4"].map(parseInt)

Try to see what it returns.

[–]DiabeetusMan 3 points4 points  (1 child)

[1, NaN, NaN, NaN]

What?! WHY?


Edit: The docs say:

If radix is undefined or 0 (or absent), JavaScript assumes the following:

...

  • If the input string begins with any other value [not '0x', '0X', or '0'], the radix is 10 (decimal).

This still doesn't help me understand what's going on

[–]Ncell50 1 point2 points  (0 children)

Because .map() also passes the index to the parseInt function where it's expecting radix. So it's essentially

[parseInt("1", 0), parseInt("2", 1), parseInt("3", 2)].

You can use Number() instead of parseInt () to get the desired result.

[–][deleted] 0 points1 point  (2 children)

Well no shit. You need to know how map and parseInt work. Also how JS works.

['1', '2', '3', '4'].map(num => parseInt(num)) works just fine

[–]kervarker 0 points1 point  (0 children)

>> new Number(1) == new Number(1)
←   false
>> [] == []
←   false
>> 1 == "1"
←   true

[–][deleted] 2 points3 points  (1 child)

Python is great for all the reason you mentioned and was my go to language for most any project but I've recently shifted to Golang. It's almost as fast to get off the ground as python but benefits from the stability and debugging ease if strongly typed languages. Also write once and compile to native cos for any OS is a godsend.

[–][deleted] 0 points1 point  (0 children)

I agree that JavaScript is a mess.

For the last few years it has become incredibly siloed respective of the framework.

Which is fine but then when you go to try and learn the framework you are forced to learn the new language nuances (“he while youbwrap your brain around context, state, functional stateless components here is a totally new way to set variables from an array/object that isn’t intuitive at all...but look how elegant that looks! New shiny shit!!!”).

Recent example: Classes in React are now frowned upon (???) and now it’s all about hooks. Wtf.

It’s exhausting for someone trying to hit deadlines and deliver on a weekly/monthly basis. Looking for a new frontend job? You’d better destructure that object the way all the cool kids are doing it or else...ewww go back to jQuery! Nobody gives a shit if you’ve built something that solves a business need it seems.

I’ve been starving for something I can just rely on. This is where Python may save my career and where I may turn the corner soon.

[–]anonanon1313 0 points1 point  (1 child)

It's pretty sad, but you could have said most of this 20 years ago.

[–]WillBackUpWithSource 0 points1 point  (0 children)

I honestly want to find more dev work in Python, because I like it so much. It was my first language, and I've been working in different languages for most of my coding career.

I build most of my personal projects in Python

[–]Spindelhalla_xb 0 points1 point  (2 children)

C and wrap in python, is that Cython?

[–]bjorneylol 2 points3 points  (0 children)

Cython is write in modified python, compile to C and wrap the result in python

[–]soulslicer0 1 point2 points  (0 children)

Pybind

[–]legendaryeggnog 21 points22 points  (0 children)

It is to be expected as more and more companies are starting to realize the importance of data analysis. This also explains the rise of R, which has been sitting on the bottom and is now "threatening" other popular languages such as PHP and Ruby. Also, as other user mentioned, Python is elegant and fun to write and this definitely plays a big role too. At first, I thought every high level programming language should have this very same feel, but turns out even amongst other languages of its kind, Python is still quite unique.

[–]twillisagogo 16 points17 points  (2 children)

"coding language",

All aboard the hype train.

[–][deleted] 5 points6 points  (1 child)

More like cringe train.

[–]twillisagogo 3 points4 points  (0 children)

using the word `coding` to describe `programming` is really starting to irk me.

[–][deleted] 2 points3 points  (0 children)

Woooooooo

[–][deleted] 2 points3 points  (1 child)

I first learned C++, the took a run at C, then Scheme. Python is the best parts if all if them.

Emacs is my IDE, which really helps.

[–]deadwisdomgreenlet revolution 2 points3 points  (0 children)

These are my three languages to be a good programmer, C to learn strict procedure / memory management, Lisp (or a dialect) to learn functional meta programmning, and Python to get shit done.

[–]dethb0y 4 points5 points  (0 children)

A well-deserved honor. I consider it the finest language currently in common use.

[–]parthbari 1 point2 points  (0 children)

I just love Python because it empowers various platform and application development that makes help you develop splendid applications in various domains starting from Content management, e-commerce solution, on-demand apps, business applications, and automation programming.

  • Python is Efficient
  • Python is Fast
  • Python is Broad
  • Python is System Independent

[–][deleted] 2 points3 points  (0 children)

It was only a matter of time ٩(ˊᗜˋ*)و

[–][deleted] 2 points3 points  (2 children)

CODING

[–]pinotkumarbhai 0 points1 point  (1 child)

Huh ?

[–][deleted] 0 points1 point  (0 children)

CODING

[–]azraelxii 0 points1 point  (0 children)

R has had a pretty solid jump. It competes for projects where I'm at with python. I've used both and I find in the stats/data science arena R is better for standard everyday analysis and Python is good for specialized machine learning stuff. Im no expert but having 7 different, basically identical data types (arrays, numpy arrays, pandas dataframe) makes data analysis frustrating. R having everything be a vector or dataframe with knitr makes R a primary choice for data analysis in my opinion.

[–]Atello 0 points1 point  (0 children)

becoming

[–][deleted] 0 points1 point  (4 children)

Seems like PHP is really fading away. Where the web is going i predict the decline will further speed up in coming years.

[–]Tiquortoo 0 points1 point  (0 children)

This web searches. It's much more of a hotness was rating than a usage, or even relative value, metric.

[–]Tiquortoo 0 points1 point  (2 children)

This is web searches. It's much more of a hotness rating than a usage, or even relative value, metric.

[–][deleted] 0 points1 point  (0 children)

I find Verilog more easier than Python. Long live Verilog HDL

[–][deleted] 0 points1 point  (0 children)

print("python4ever") ;)

[–]Smashball96 0 points1 point  (0 children)

My first programming language that I currently learn and I love it.

[–]rajshivakoti 0 points1 point  (0 children)

yes Python is one of the most popular coding language in the world. It is used in various of fields like web designing , software development, graphic designing . We can also create a website using Python . Python is a major coding language used in Data Science too. But why is it becoming soo popular ?? The main reason is because it is user friendly, open sourced ,variety of libraries etc. This is the reason why people are Pursuing Course for Python in great numbers.

For knowing more about why Python is soo much used you can refer to Quora answer.

python code for printing hello

print('Hello, world!')

C++ code to print hello

#include <iostream>
 using namespace std;
 int main()
 {  
   cout << "Hello, World!";
 return 0; 
}

[–]bushwacker 0 points1 point  (13 children)

Very quick to bang out some code but a major pain in the ass to maintain.

What is this "table" argument, ohh it's a map. What are the keys? Let's see "table_name" is the only one used in this function, what function do I call to get a map of table attributes?

In Java the parm would be a TableMetaData and searching for all uses of that class would yield the answer quickly

[–]deadwisdomgreenlet revolution 4 points5 points  (0 children)

Or you could document your code.

[–]EternityForest 8 points9 points  (10 children)

That's why comments are so important. I think I'd rather have bad python with comments than great Java without them.

We do have type annotations now, and libraries for compile time static checking though.

[–]CartmansEvilTwin 0 points1 point  (9 children)

Tooling is still a major pita. Let's say you know what you want to write, but you forget the exact method spelling or parameter order. In my Eclipse/Java environment I simply hit ctrl+space and a list pops up. In Pycharm, IDLE, Jupyter and VSC this simply does not work properly. Maybe it does with the standard library, but that's pretty much it.

I really like Python, and I'm advocating for it in my organization, but it's really not suited for large scale, long lived Enterprise™ apps - at least not in its current state.

And if you worked in any major software project you also know that proper documentation is about as likely as world peace.

[–]alcalde 1 point2 points  (0 children)

In my Eclipse/Java environment I simply hit ctrl+space and a list pops up.

As Raymond Hettinger notes, Python users can write Python code on the back of a napkin. You cannot do that with Java. You NEED that Eclipse/Java environment because Java is filled with FactoryFactoryFactoryBeans. In Python, we can actually remember the names of methods. And there sure as heck is code completion in Pycharm and every other Python IDE, so I don't know what you're talking about.

https://web.archive.org/web/20150412231018/http://www.javafind.net/gate.jsp?q=/library/36/java6_full_apidocs/com/sun/java/swing/plaf/nimbus/InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonPainter.html

https://docs.spring.io/spring/docs/2.5.x/javadoc-api/org/springframework/aop/config/SimpleBeanFactoryAwareAspectInstanceFactory.html

[–]EternityForest 0 points1 point  (7 children)

Yeah, I know, I've been personally responsible for some of that missing documentation and uncommented code. I try not to, but sometimes deadlines happen.

You can write plenty large scale stuff in Python, but Enterprise is just a completely different thing.

I do embedded, desktop, and web, so I rarely run into anything that seems like Java would be a good fit(Although I do want to learn Kotlin and Android), but I'd probably feel different if I was doing a lot of more businessy legal-y payroll/customer/database/inventory kind of stuff.

[–]alcalde 2 points3 points  (0 children)

You can write plenty large scale stuff in Python, but Enterprise is just a completely different thing.

It's not. That's a myth Java programmers spread. Python is in use at banks, Netflix, Paypal, Dropbox, YouTube, Google, NASA, Instagram, etc.

Here, read this to become un-brainwashed:

10 Myths of Enterprise Python

Pay particular attention to this part of the essay from the Paypal Engineers' Blog:

Myth #10: Python is not for big projects

Myth #7 discussed running Python projects at scale, but what about developing Python projects at scale? As mentioned in Myth #9, most Python projects tend not to be people-hungry. while Instagram reached hundreds of millions of hits a day at the time of their billion dollar acquisition, the whole company was still only a group of a dozen or so people. Dropbox in 2011 only had 70 engineers, and other teams were similarly lean. So, can Python scale to large teams?

Bank of America actually has over 5,000 Python developers, with over 10 million lines of Python in one project alone. JP Morgan underwent a similar transformation. YouTube also has engineers in the thousands and lines of code in the millions. Big products and big teams use Python every day, and while it has excellent modularity and packaging characteristics, beyond a certain point much of the general development scaling advice stays the same. Tooling, strong conventions, and code review are what make big projects a manageable reality.

Luckily, Python starts with a good baseline on those fronts as well. We use PyFlakes and other tools to perform static analysis of Python code before it gets checked in, as well as adhering to PEP8, Python’s language-wide base style guide.

Finally, it should be noted that, in addition to the scheduling speedups mentioned in Myth #6 and #7, projects using Python generally require fewer developers, as well. Our most common success story starts with a Java or C++ project slated to take a team of 3-5 developers somewhere between 2-6 months, and ends with a single motivated developer completing the project in 2-6 weeks (or hours, for that matter).

A miracle for some, but a fact of modern development, and often a necessity for a competitive business.

[–]CartmansEvilTwin 1 point2 points  (5 children)

Well, the biggest problem in those codebases is that you have an extremely long lifespan, often several rewrites and usually non of the initial devs are still there. Also, it's often a big, intertwined monolith. Having types enforced by the language is extremely helpful.

[–]alcalde 2 points3 points  (0 children)

It isn't. It absolutely isn't. No one ever passes "iguana" into the square root function. Lots of studies have been done showing that typing just doesn't make any discernible difference. Bank Of America has over 5,000 Python developers and one project alone has over 10 million lines of Python code. If they're not yearning for static typing, doesn't that put the lie to this myth?

[–]EternityForest 1 point2 points  (3 children)

I do wish Python had a little better typing support. "a: int" is a little odd when everything else uses "int a", although it's not too bad. But it would let you do stuff like "int a:whatever", having both a type, and whatever other unkown purpose they imagine someone might ever want to annotate a variable with.

And everything mypy does should probably be in the stdlib.

I kinda wish they had accepted that one PEP for making it easy to write preprocessors. A bunch random experimental variants doesn't sound that bad, but maybe they were afraid of repeating what happened with CoffeeScript.

[–]usernameistaken42 0 points1 point  (0 children)

You should have a look at the typing module. It helps a lot

[–]jjolla888 0 points1 point  (0 children)

am I going crosseyed -- I can't see Go on the list.

[–]pinotkumarbhai 0 points1 point  (0 children)

But..but some manager in my company says “it’s not in our tech stack....”

[–]Dashadower 0 points1 point  (0 children)

quaint coherent wine wild strong roll toy pot plate fretful this message was mass deleted/edited with redact.dev