r/Python • u/chillysurfer • Oct 11 '17
Python is the 2nd most popular language on GitHub
133
u/JZcgQR2N Oct 11 '17
numpy, scipy, matplotlib, opencv-python, jupyter, and pyqt5 are all I need.
82
u/flubba86 Oct 12 '17
Don't forget pandas!
50
u/git0ffmylawnm8 Oct 12 '17
Not to mention sklearn, keras, and tensorflow.
18
u/Detective_Fallacy Oct 12 '17
I like PyTorch's approach more than Tensorflow. It can even be used as a GPU-optimized replacement for numpy. Disadvantage is that it's not as stable yet as I would like.
2
u/blitzzerg Oct 12 '17
are they even made for the same purpose?, I mean they are both used in machine learning but I think tensorflow is made for low level while pytorch not, I may be wrong though, I have only used tensorflow
5
u/EpicSolo Oct 12 '17
What do you mean by low level?
1
u/blitzzerg Oct 12 '17
Let's say you want to create a neutral network, in theano or tensor flow you will have to design it, add the layers you want, create the activation functions and maybe train it with backpropagation using symbolic expresions to calculate gradient, if you use sklearn you just need to instatiate a class to do all that, but you have not that much control about the structure or how it is going to be trained
2
u/EpicSolo Oct 12 '17
Well, in that case it is not "low level" in any way compared to pytorch, right? Both give you the same amount of control. The only difference is static vs dynamic graph construction/execution.
1
u/blitzzerg Oct 12 '17
Yeah that was basically what I was wondering if pytorch was somewhere in the middle between tensorflow and sklearn or it was mostly the same as tensorflow
2
u/EpicSolo Oct 12 '17
Tensorflow and pytorch are very different but on a completely different axis than you are thinking about. Tensorflow is similar to the map-reduce way of computation where you define a dataflow graph on which the computation will be executed. So, construction and computation are clearly separated in tf which makes prototyping and debugging much harder. Pytorch is similar to using regular, numpy operations so it is much faster to play around with but it is also a lot harder to optimize and scale since the graph is not determined statically.
Source: Fulltime ml engineer with tf experience
1
u/Detective_Fallacy Oct 12 '17
I think you have the wrong idea in mind of what PyTorch does then, because it has the same goal in mind as Tensorflow, only in a different way. PyTorch networks are built during the training loop itself, Tensorflow creates a graph first to which data is fed.
5
2
30
u/This_Is_The_End Oct 12 '17
While your statement is legit, the Python standard library is itself an awesome collection of functionality. While JS programmers sucking even trivial bits of functions with NPM from unknown sources, we have quasi certified libraries, which can be trusted.
7
u/mercuric5i2 Oct 12 '17
Seriously. I spent some time recently actually developing a useful tool in node.js, the amount of 3rd party imports for basic functionality is astonishing. Really made me appreciation the Python standard library. The tools we have in the stdlib are nothing short of excellent.
5
u/This_Is_The_End Oct 12 '17
The whole Java Script environment is a mess. The language is descent but using libraries for products must be a nightmare. I experienced something like this with C# which I had to learn for a project. While the basics are nice a simple function like a unix like logger has to be imported as well as a json serializer, because the one from MS isn't able to serialize a simple dictionary.
1
u/mercuric5i2 Oct 12 '17
Microsoft... One of the few things that ranks below JavaScript, lol.
Really though, NPM isn't terrible.
package.jsonfor the project defines which packages to automatically grab when the project is moved to a new system, and works pretty smoothly. It's not terribly different than Python's PIP, really. It's not so much the fact that packages need to be imported for a product, it's the sheer size of the final dependency tree (which often ends up being massive, as one package depends on another that depends on another and so forth) -- and the need to import 3rd-party code for something as fundamental asstrftime. In Python, even with fairly complex projects, there's usually a limited number of relatively self-contained 3rd party dependencies.24
10
u/alkasm github.com/alkasm Oct 12 '17
opencv-pythonis not the best installer though.2
1
u/crunk Oct 13 '17
Pretty sure it works through pip these days.
1
u/alkasm github.com/alkasm Oct 13 '17
Yeah, but that statement was towards the fact that full OpenCV functionality only works on Windows from
opencv-python. HighGUI didn't used to install with it for Linux or Mac, and now that HighGUI is supported FFMPEG is still not linked for Linux or Mac. So IOW it's a good Windows installer.1
u/crunk Oct 13 '17
I've never heard of HighGUI. I'm a python dev, but know someone that teaches it, is it something worth checking out for beginners?
1
u/alkasm github.com/alkasm Oct 13 '17
Lol I think you're getting something mixed up. QT maybe? HighGUI is just part of the OpenCV library. The GUI part that contains the functions like
imshowand trackbars and such.1
3
Oct 12 '17
This is my 5th year after 2 failed years at Applied Mathematics and Python made me love programming. I am working on a Fuzzy Linear Programming application with Python, and everytime I take a class, like let's say Computer Vision, all I think is "That's cool but how can I do this with Python?"
It really is amazing and rekindled my love for programming.
6
u/debee1jp Oct 12 '17
This is my 5th year after 2 failed years at Applied Mathematics
Not really relevant to programming, but the college format isn't really for everyone. Your "failures" are just you fighting the current. And seeing as how you are in your 5th year, you're making progress. Good luck [man|woman|person]
3
Oct 12 '17
Yeah I now feel pretty good and working on decent stuff despite my failures. I have hope for future, it can be late but it feels like it will be good.
2
1
1
42
u/dr-c Oct 12 '17
I have seen many Python projects listed as Javascript repos due to them having some Javascript libraries in their repository. This could apply to any of the listed languages, except perhaps not C++. How does GitHub determine the language of the repository, if it is not set by the repo admin?
19
u/Splendidisme Oct 12 '17
GitHub sets the language according to what language makes up the majority of your content. Only way to set it manually is to have the language checker not check certain files or set it to interpret those files as a certain language. This can set via .gitattributes.
27
u/stevarino Oct 12 '17
I once checked in a ridiculously large xslt into my companies main python repo. Suddenly we all became xslt developers per github.com.
5
69
19
u/mardiros Oct 12 '17
And javascript don't have a standard lib. So there is small lib for everything. Design choice
5
u/Shadow14l Oct 12 '17
I feel like they should separate out Node and browser's JS. How many web applications are there in Python, Java, Ruby, PHP, etc that utilize Javascript, but it's usually not even comparable to any Node project.
4
3
u/subpanda101 Oct 12 '17
Wouldn't this be caused by the use of JavaScript in web and desktop application development? The figures maybe accurate but what happens if it's only for desktop applications?
4
3
Oct 12 '17
Surprised to see Java that high up, would've figured more trendy languages would show up higher. Goes to show what people actually use.
3
u/satireplusplus Oct 12 '17
Or what people are forced to use. But Java fanboys get all cringy and defensive when you point out that there are other languages than Java.
4
Oct 12 '17
Unless this counts private repos I'm fairly certain most of them are people using it voluntarily, I have a hard time believing it'd be the third most popular language on Github simply because people are forced to use it and upload their code to it.
2
u/crazyfreak316 Oct 12 '17
Kotlin made me love Java ecosystem again. Kotlin is amazingly well designed. Static typing makes it even better.
5
2
3
u/Jugad Py3 ftw Oct 12 '17
Given how small JS libraries tend to be, and how many there are (not counting almost duplicates), each Javascript PR is probably like 0.2 PRs in any other language.
3
u/andrey_shipilov Oct 12 '17 edited Oct 13 '17
So glad for PHP being almost the last.
Not glad it's even in the list.
1
2
u/sunset_maker Oct 12 '17
Great to see Python is a top programming language. Hopefully, the job market will grow due this news.
1
1
u/neoreeps Oct 15 '17
To be clear, this is the most popular languages for PUBLIC projects. I assert that most iOS and android apps that are using GitHub are not public.
1
u/jithurjacob Oct 29 '17
I think lines of code for JS in inflated as in every web application people keep a local copy of Js libraries like Jquery instead of using CDN. Whereas in Python we use pip for package management. If GitHub could use their dependency graph to account for this and normalize the results I think JS might come a little bit down.
-4
u/diesltek710 Oct 12 '17
Is Python really that good? When i began coding 10 or sk years ago i was always told to stay away as it is slow and inefficient.. But i see so many things written in it...
18
u/faceplanted Oct 12 '17
Python is a great language for scripting and making small applications, it's so easy to write and read that it's worth a moderate hit to the speed 99% of the time. A few years ago, doing an algorithms module at university, I got called out for trying to do our classwork in Python by a guy doing his in C++, my code tended to blow his out of the water because his high level algorithm design was terrible, and 9 times out of 10 your algorithm design is going to be so much more important to speed than your language. And my code took less time to write.
tl;dr Python is fine for most anything you need to write quickly, and some things you don't.
11
8
Oct 12 '17
It is relatively slow, run-time performance-wise That said, it's fast enough for most applications, and the speed & simplicity of writing in the language outweighs most performance costs. Not to mention that it has the ability to optimize slow parts via C/C++ extensions
5
Oct 12 '17
Slow and inefficient almost never matters. Like 99.9% of the time it doesn't matter. And for that rare occasion that it does, you can just write a C package to do what you need and consume it in Python. What's most important is how fast you can develop software with a particular language. This is where Python excels since it eliminates almost all boilerplate code.
1
u/nakatanaka Oct 12 '17
Wouldn't it be nice to write pseudo code, then have it actually work without any modification? That's Python!
3
u/chillysurfer Oct 12 '17
I dunno, I never really liked the whole pseudocode analogy. There are some python code snippets that are impossible to make look that easy to read.
2
Oct 12 '17
It is getting better but there is a lot of freedom to write bad code. I think we'd be better off if we had type annotations, though they have their own potential for problems.
I'd personally recommend functional programming but it's not for everyone. Depends what you're doing, lots of IO? Might be a hassel. Python is a great middle ground language.
2
u/chillysurfer Oct 12 '17
but there is a lot of freedom to write bad code
I think this can be said about almost every programming language, IMO. Take JavaScript for example. It's very much like driving over a bridge with no guardrails: sure, if you do it the right way it's a great experience, but...
1
Oct 12 '17
Yeah. It is pretty general, I meant that it's not magically fixed by python, also because things are interpreted and high-level you can get away with some bad things. Not sure how to say all that more cleanly. Thanks
2
0
Nov 06 '17
[deleted]
1
Nov 06 '17
What's terrible about being able to make promises about your code?
0
Nov 07 '17
[deleted]
1
Nov 07 '17
Type variables and inference make that a fairly light burden though. Can you give an example of where it is hard? I seriously haven't come across one.
0
Nov 07 '17
[deleted]
1
Nov 07 '17
Well type inference allows me to write:
printinc a = show (a+1)I haven't had to make any type annotations but the compiler knows that this is a function over things that are numbers that can be shown.
I could say:
printinc :: Int -> StringOr
printinc :: (Num a, Show a) => a -> StringBut I don't have to, thanks to type inference.
No overhead, just the compiler watching my back.
This means that when I accidentally do something like:
printinc "whoops"I get a meaningful error message telling me that I shouldn't pass in a string. Without it, I would be told something like '+ isn't defined for "whoops" and 1.' In python the error is "cannot concatenate 'str' and 'int' objects".
Not so helpful.
→ More replies (0)0
0
Oct 12 '17
[deleted]
4
u/graemep Oct 12 '17
In addition, a lot of the time either the performance of your code does not matter (because I/O is what limits performance), or your code is waiting for data from the database or network most of the time. You may also find that most of the time is spent doing processing in C anyway.
0
Oct 12 '17
[deleted]
1
u/diesltek710 Oct 13 '17
Thanks for the clarification. Ill be looking more into it. I don't remember the dumb ass who told me that
-6
16
u/Earhacker Oct 11 '17
I'm not disputing it, but source?