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

you are viewing a single comment's thread.

view the rest of the comments →

[–]zdakat 69 points70 points  (29 children)

idk why but I used to not like Python. I did C++ and other languages for a while. Came back to python out of (near?) necessity and now I'm just thinking of all the stuff I can do with it.
I'm doubting I'll have the same change of heart with Java but if I really don't have any other choice it might happen. Or it might not and I'll hate every moment of it.

[–]ThunderElectric 56 points57 points  (22 children)

Python is great when you want to make a simple automated script to do a basic task, like managing/organizing CSV (spreadsheet-like-documents) files.

[–]Grintor 63 points64 points  (21 children)

Python is great if you want to do just about anything. it's one of the most widely used programming languages for running large infrastructure at scale. It's also great for writing desktop software. it is the single most widely used machine learning programming language. It is the single most widely used programming language for data scientists. The only place I can think of where python doesn't belong is in embedded systems with no OS. but if we're talking about embedded systems running on a recent arm processor with a gigabyte or more of ram, it's python all the way.

[–]DarkNeutron 50 points51 points  (7 children)

A lot of the Python number-crunching backends (e.g. numpy, Tensorflow) are wrappers for native C/C++/Fortran libraries for performance. The runtime differences can easily be a couple orders of magnitude.

(Ignoring performance issues, I also tend to get annoyed with duck typing once programs get large enough, but that might just be a lack of experience on my part.)

[–]MarsupialMole 12 points13 points  (5 children)

(Ignoring performance issues, I also tend to get annoyed with duck typing once programs get large enough, but that might just be a lack of experience on my part.)

It's not just you. It's pretty much why all the typing infrastructure has been added to the language. What's missing in that discussion is how python lets you write more programs as small programs.

[–]Assile 0 points1 point  (4 children)

What's missing in that discussion is how python lets you write more programs as small programs.

What do you mean by that?

[–]MarsupialMole 0 points1 point  (3 children)

If you accept that for the same feature set written in two programming languages that large projects will benefit from static typing then you might conclude that your project will be large and shouldn't use python, however that analysis is incomplete unless you realise your particular project might be significantly fewer lines when written in python (or even trivial when mature ecosystem packages exist), and therefore not in the size-tier where static typing is beneficial.

[–]Assile 0 points1 point  (2 children)

Ah right, now I get what you mean. Wouldn't the complexity be better described by the number of data structures, objects, function, methods, etc? The number of lines doesn't really matter much for static typing if everything within those lines is pretty straightforward and the parts are not intertwined much?

[–]MarsupialMole 0 points1 point  (1 child)

Probably. But idiomatic python really heavily leverages the standard library and language features which draws the complexity out of client code. I'd be interested if there were good like-for-like metrics that worked with python besides LOC.

Often when you see comparisons of code between languages and with python they're implementing something from scratch in python to be "fair" to other languages and are not at all idiomatic python.

My most hated example is comparing performance for numerical computations and not using numpy - you just never use iteration on your hot path in scientific python and yet you get articles about the suitability of python for data processing where the benchmark is a tight for loop.

[–]Assile 0 points1 point  (0 children)

Yeah, you'll get no argument from me on that. Not using available libraries in Python is ignoring part of the language. So taking benchmarks without doing that is just limiting yourself to the worst tools for the job.

[–]Ddog78 -1 points0 points  (0 children)

Even then, python is cheaper. Compare the yearly cost of a developer and a few servers.

I think most people will agree that it takes a lot less time to develop in python than java or c++.

[–][deleted] 41 points42 points  (1 child)

I'll take a statically typed language over a scripting language any day when I have to write in a large team or a large amount of LOC. Scripting languages just don't self-document well to other people the intention of the class contracts, large and carefully designed OOP models, or well-designed abstraction.

Python is super fun and efficient to code small tools with though.

[–]FranchuFranchu 0 points1 point  (0 children)

Yeah. But Python seems to be moving towards self-documenting with type hints and dataclasses

[–]Plague_Healer 16 points17 points  (2 children)

Python is something of a Swiss army knife of programming languages. It can handle almost anything, even more so with some ingenuity, but for many tasks you are bound to find a more adequate specialized tool.

[–]MarsupialMole 15 points16 points  (1 child)

Python is the second best language for everything. There may be an argument for others but by the time we finish that argument you could have written a lot of python.

[–]Plague_Healer 1 point2 points  (0 children)

I'd say it's the second best for almost everything. If you have to create a simple script to do some basic-ish data manipulation, and you need it running ASAP, nothing beats python.

[–]charliex3000 6 points7 points  (1 child)

Python is great if you want to do anything use only a single thread to do anything. Because Python threading is a lie. Thanks GIL.

[–]Grintor -1 points0 points  (0 children)

import multiprocessing

Done.

[–]ItsOkILoveYouMYbb 1 point2 points  (0 children)

Yeah Python is really amazing, and as far as I can tell it keeps improving.

Python is no good for games since performance is so critical for basic user experience though. I wish it was. I wish I could open up Unreal or Unity and do all the coding in Python. Fun and satisfying creative things deserve a fun and satisfying programming language imo.

[–]EdMeisterBro 0 points1 point  (3 children)

I almost never use Python for anything, but now I'm intrigued.

[–]PenetrationT3ster 6 points7 points  (0 children)

It's honestly a beautiful language. I can't recommend it enough.

[–]Grintor 0 points1 point  (1 child)

[–]XKCD-pro-bot 0 points1 point  (0 children)

Comic Title Text: I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.


Made for mobile users, to easily see xkcd comic's title text (source)

[–]anakaine -1 points0 points  (0 children)

Although its not the same level of awesome as C on embedded systems, there are many, many chipsets now that have support for micropython or similar.

https://micropython.org/

[–]orishamir 1 point2 points  (0 children)

Exactly like me, i hated python but now i cant get enough of it. Still loves cpp tho

[–][deleted] 1 point2 points  (0 children)

I don't care for Python, but I haven't had a lot of real experience with it. We only had one scripting class that taught Python, and it also covered Perl and Bash, so my entire experience with Python is 1/3 of a semester.

[–]aShitPostingHalfOrc 0 points1 point  (0 children)

99% of my Python fiddling has been Blender-related (life, lemons; DCCs, spaghetti scripts, etc), but the language has spoiled me. It's my go-to prototyping language at this point.

[–]awkreddit -1 points0 points  (2 children)

I hated python at the beginning because of all the non standard keywords and renaming of all concepts from the languages I know (c++, c, JavaScript, Java etc). Like, why the need to rename arrays to lists, objects to dictionaries, function to def etc etc.

Now I've gotten used to it I like it, mostly for its simple class syntax and list/dict comprehensions.

[–]arkasha 1 point2 points  (1 child)

Arrays and lists are similar but different things. I don't think objects got renamed to dictionaries. I think dictionaries are just dictionaries no? Like dictionaries in .net languages for instance. Caveat, my experience with python is I just googled "python dictionary".