Been doing a lot of coding in python lately. While some of the hackability of the language is nice for doing some cool things, overall, I cant say im a fan. Its a little too obscured for writing algorithms where effiency is important. Its hard to tell what data types are truly backing various variables and thus makes it tricky to pick the right implementation. I think im working with raw arrays and they turn out to be linked lists or worse. Even then things like a "Dict" isnt always clear if its a Tree implementation or a hashmap implementation or something else entirely.

Granted this isnt an impossible task, I have managed to figure it out by pulling open the source code of the libraries I call and using profiling tools. But python seems to not care or obscures a lot of that.

@freemo I think that python is optimised for reducing *development* time. It's good for when you need to do something quick-and-dirty, the sort of thing where you need to only ever run it once or twice and you're really not going to be stretching the processing or memory bounds of the computer. The sort of thing where it's important that the code be readable, because there's a good chance that if you ever want to run it again, you'll need to tweak it a bit, first.

And in that narrow domain, it's really very good. But outside of that domain, it's probably not the best choice...

@ccc

While I might agree that it is geared towards shorter development time it seems odd to me it finds so much use in scientific circles considering its not well suited for it.

Also I think readability can be interpreted in different ways here. I'd say due to the ability to hack code it really isnt very readable in a meaningful way. You can look at code and have no idea what it is **really** doing and can be rather difficult to find out. thats the opposite of readability in my mind.

The only way I sorta see the readability thing is just with the tabs and the syntax it might be easier to scan lines of code, but thats a small part of readability in my eyes.

But I do agree that it does a fine job at minimizing single-developer start time on small projects where performance doesnt matter.

@freemo Python is used in a lot of places that it is not really all that well suited for. This seems to be largely because someone discovers how great it is with short, quickly coded, demonstration problems - which is where it is at its best - and then starts trying to use it for everything.

Now, it can *do* just about everything; and having a shorter development time is a solid advantage in a large slice of 'everything'. It's just that, once you get away from simple demonstration problems and into large, serious projects, then there are usually other languages that work out better; but even there, there's a very large category of problems where the difference might be fairly marginal.

So it gets used in a lot of places where it's not the best choice - because in some of those places, it's still a *decent* choice, just not the *best* choice.

@ccc I generally opt to use python for the same reason i think many others do, and ultimately why it gets overused.... its popular.

I have a motivation to use the most popular language (of which python is it) because that means a larger audience and more chance of both consumers, clients, and contributors.

The worst part about it is the more it is used where it isnt suited the more pressure there is to use it even when it isnt suited.

Follow

@freemo Oh, yeah; and that popularity comes, I suspect, from the fact that it is *super* good at the sort of quick demonstration problems that one can use to show off the capabilities of a language.

But I think that the recent sunsetting of Python 2 is also important to bear in mind when developing for the language. Some languages have long-term stability - the sort of language that you can write software in and then expect that software to continue to work over multiple decades (after which a developer the age of your grandchildren, chuckling at the quaintness of your code, will probably go to a lot of trouble to rewrite it such that it takes proper advantage of quantum computing or similar). Python is not one of those languages. Python is a language for the short term; a language of quick results and instant gratification, to be used in situations where it can be maintained on-the-fly by in-house (or on-contract) programming staff.

Which is an important niche. But not, by a very long shot, the *only* niche.

ยท ยท 1 ยท 0 ยท 1

@ccc yea being good for "I slapped this together real fast" means it gets more exposure even if someone may not use it as their primary language, it willb e disproportionately represented.

I have no shortage of complaints about python, in fact I dont code in it too often, just when getting contributors is a top prioority or when its geared towards developers and a lot of adoption means more $$$. In general its actually one of the last languages I will use. So I dont need many reasons to dislike it, the whole python2 nonsense is a **huge** one, I also dont like that it is strict on whitespaces, the lack of true privacy/protected elements, and the other points we discussed.

If i dont get about the size of the user base but I need something that has the advantages of python with fewer of the annoyances I go with Ruby actually. Even then Ruby isnt my top choice of a language for enjoyment or for serious projects.

@freemo Though there are a lot of issues with python in many situations, I find I actually like its strictness on whitespace. It means that when I glance at the code, it's super easy to tell how far loops go, and where loops end. In C++ (which is what I use when I want to do something serious) it's quite trivial to create code such that what *looks* like a loop is actually *outside* the loop, which has potential implications for maintainability. (Now, I can get exactly the same effect by telling emacs to auto-indent the entire C program; so python's whitespace strictness only really saves a couple of keystrokes. It's still nice, though.)

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.