array,
@array@fosstodon.org avatar

I like . It was the first programming language I tried, it had a reputation of being easy to learn and yeah, it was. What I don't really understand is how it has become so popular (# 1 in the TIOBE index...) and pervasive (you find it in areas where it seems like logic for a scripting language, but in others where you wouldn't bet for it too). It shines where it shines, but aren't really there better options in some of the niches it is being used for?

mdione,
@mdione@en.osm.town avatar

@array I see two reasons for that:

  • in those niches, people are mostly non developers (I worked as the IT guy in an Astronomy Research Institute), so languages that are easy to grasp are a boon for them.

  • in those same niches, sometimes it takes just a head of a department to chose a tool and the rest will follow.

array,
@array@fosstodon.org avatar

@mdione Yeah, I get why, and I can see things are good enough as they are. I was just asking myself if they could be better, and asking myself if using domain specific and arguably better suited alternatives could contribute to improve things a bit. Not that I have an answer or really strong opinions, though; I ask because I want to learn, and really appreciate opinions from people with experience and knowledge, so thanks. :)

mdione,
@mdione@en.osm.town avatar

@array TBF, people in that research institute were not using Python, but one of them was, and at some point I gave a short course to some 4-6 more (I think the institute was around 20-40 people in total). I don't remember what were they using, probably FORTRAN.

array, (edited )
@array@fosstodon.org avatar

@mdione There's quite a long way from using Fortran to Python (with maybe some C-or-Fortran-written libraries), that's for sure. ;)

mdione,
@mdione@en.osm.town avatar

@array well, the ones they most used (at least this guy, as I remember it; it was ~15ya) already had python wrappers to their libs, and he was enthusiast on learning Python, so...

clacke,

@array There really is very little you need to go outside python for, so people don't.

Scripts? Check.
Well-factored applications? Check.
Static type-checking? These days, check.

It really is a wide range, and while it is not too performant, most of the time your code is waiting for I/O or a human. When performance is actually needed, heavy calculations go into pandas and numpy and on the other end things like protocol parsing go into gunicorn and starlette.

Python's got you covered. Best language for almost nothing, good enough language for almost everything. More boring than Ruby, less line noise than Perl.

array,
@array@fosstodon.org avatar

@clacke Yeah, it's really pervasive. And very good at what's good, as I said, I like it too. It's just the point that you raise, "best language for almost nothing", that brings me some doubt. As in, why not just use "the best tool for the job", when there are arguably better options in some domains? Using Python for everything sounds just a bit... Lazy, I guess? :P

geraldew,
@geraldew@fosstodon.org avatar

@array @clacke all the more reason to see its position as a very good prototyping language. Perfect for demonstrating what the final program should do, much of how it can work and good enough to use until the "production" replacement is completed.

array,
@array@fosstodon.org avatar

@geraldew @clacke That seems like a very valid use case indeed, yeah. ;)

clacke,

@array shrug

I know 20+ languages. My colleagues don't. Or if they do, not the same ones. Except Python.

array,
@array@fosstodon.org avatar

@clacke That puts a different problem then. A complicated one. ;)

There's quite the possibility I'll end up writing Java, which has been/is its own Swiss Army knife. Is it more performant than Python? I think so. Has its own trade-offs? Hell yeah. I'm still refusing a bit the idea of silver bullets, but I think I'll just keep my questions open. ;)

a13cui,

@array I have a harsher opinion of Python than other people (as in I believe it is, and excuse my advanced Ancient Albanian Sign Language, dogshit). Python is lucky it can access C and Fortran because otherwise no one would use it in any scientific context. To rapid-fire the shit I hate about Python:

  • The package names are so inconsistent (PyPy, PyPi, NumPy, SciPy, SymPy, PyGtk, Pyglet, PyGame, SQLAlchemy, BeautifulSoup...)
  • It loves solving problems through syntax and badly-written abstractions instead of using the language itself
  • Good luck making a program that doesn't make the PEP 8 linter trigger-happy
  • You need different versions of pip for every Python version (go right now to your terminal and do ls /usr/bin/pip{2,3}* 2>/dev/null) and there are multiple conflicting version management solutions (pyenv, venv, poetry...)
  • The package management is horrible (shit, it makes CPAN look like something God sent from the heavens)
  • "Pythonic" code is meaningless and mostly means you copy obtuse shit from SO (you might as well copy Perl too)
  • A lot of Pythoners seem to only know Python and are unwilling to learn everything else because for them everything is a nail
  • The same people love to use non-standard nomenclature for shit already established in the CS community (they call arrays "lists", they call associative arrays/hashes "dictionaries" etc.)
  • Wait until you play with quotes in Python
  • You have to work hard to pass things by value (the most reliable method so far is a=copy.deepcopy(b) because not all objects have .copy())
  • if you do something like gcc -o screencapture.exe screencapture.c -lscreencapture, GCC knows you want to import screencapture.h, but in Python if you do the same thing it wants to import the local code first (glhf if you have a screencapture.py file...)
  • Even though the docs also accept tabs, PYTHONERS SCREAM AND WANT 4 SPACES!!!! Nothing else allowed.

This is as much as I can write in 2k chars.

array,
@array@fosstodon.org avatar

@a13cui This is the kind of "hot take" I particularly love to have, if just to get a counterpoint to the straight opposite. You raise interesting points, thanks! :)

array,
@array@fosstodon.org avatar

Yes, may be easier to learn at first, but when things get complicated, you may want to add a bit more boilerplate in exchange for static typing, for example. And performance... Python doesn't seem very good at that, even compared with other scripting languages, not to mention compiled ones. Is Python really a "silver bullet" for everything? With alternatives waiting to be explored like say or indulge me in having my doubts. :P

tranzystorek_io,
@tranzystorek_io@fosstodon.org avatar

@array From a package maintainer's standpoint Python is comparable to a C project with a poorly written makefile though. The ecosystem is full of old setup.py configs that either make packaging difficult and niche or make the users resign to pip altogether.

array,
@array@fosstodon.org avatar

@tranzystorek_io External packages are always a bit... Complicated, no matter the ecosystem, I guess. I've used node, composer, Maven, pip and others, and there's always pros and cons. The main point stands, Python doesn't really seem to make a big difference here... But to be fair, it has achieved a very huge ecosystem. Including for use in niches where it wouldn't seem the best first option, though. ;)

gregorni,
@gregorni@fosstodon.org avatar

@array Python is really not meant to be fast, if you want performance, you simply just don't use Python. As with any other language, there are area where it shines, and areas where it's useless. It really depends what you want to use it for.

You can add static typing to Python with tools like mypy, by the way.

As for other languages: Try them out, whether they end up being suitable or not. It's always good to gather experience by learning new programming languages.

sotolf,

deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf Yeah I know, and that seems to work well. If only because most of the people actually needing to use those libraries are not exactly programmers, so they just need to learn the Python bits needed to interface with those libraries.

    But still. What if they resorted to "interface" with actual programming engineers instead, and let them choose the most efficient way to achieve their objectives?

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf Yeah good point, but at the end of the day, people end up "interfacing" with each other all the time, particularly in domains as web dev... Maybe giving a Python interface so scientists and mathematicians can use their libraries is a better solution in that case, though. I need to know more about it before shaping a real opinion I guess. :)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf Yeah but still, wouldn't it be even better in, say, Nim or Crystal? Their syntax is not more difficult I think, they both interface with C, and performance-wise there's just no comparison. Python sure is "good enough", I was just asking myself if it can be better. :)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf You can in Crystal... But no matter, I get your point. Still, we're talking mathematicians and scientists... I guess they can overcome these kind of difficulties when dealing with their code. ;)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf Were you referring to lists and hashmaps with different types in Crystal? If it was that then I may have misunderstood, but the Crystal docs seem to indicate that:
    In arrays: https://crystal-lang.org/reference/1.9/syntax_and_semantics/literals/array.html
    And hashes: https://crystal-lang.org/reference/1.9/syntax_and_semantics/literals/array.html

    sotolf,

    deleted_by_author

  • Loading...
  • sotolf,

    @array Of course you could do that with nim as well, but it would not be performant, and it would be a bit more annoying to write, in nim you always have to define your types, so you would have to define a union and then use that, and you're basically left with more complex code that performs worse, so I'm okay with it being more difficult to do. It should be simple to do things the performant way in my opinion.

    array,
    @array@fosstodon.org avatar

    @sotolf Ah, you just said that you can't put different types in a list or hashmap... You can in Crystal -with union types-, which may require a particular treatment, but still. And, both in the same page again now that we both know what we meant. ;)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf How's Nim's LSP, by the way? I didn't use any when I first tried it, and after a not that great experience with Crystal I got curious. I know you can write code without that, but I'm spoiled by Java and PHP ones I guess, and now I really miss not having its full functionality. ;)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf Python or not Python, languages like Nim need more eyes on then. How can a language develop an ecosystem if everybody's too busy with their own silver bullet? :P

    Thanks! Looks like it's good enough at this point... :)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf I tend to get a bit worried when everybody seems to be using one and only one thing for whatever... We FOSS users/ programmers/ sysadmins are already a bit niche, that's why I love that things like Nim, *BSD, musl, runit, window managers etc exists. For me, an ecosystem with variety is a good ecosystem, with options competing to get better, where everybody can collaborate to achieve the goals, and everybody gets to choose. :)

    array,
    @array@fosstodon.org avatar

    @sotolf Sorry, can I... What? Overcome difficulties? I've lost the context I think. ;)

    And yeah, we're on the same page here. I understand all of this. My head tends to keep asking questions, though; it's usually a good way to keep on learning. :)

    sotolf,

    deleted_by_author

  • Loading...
  • array,
    @array@fosstodon.org avatar

    @sotolf They really are. ;)

    bignose,
    @bignose@fosstodon.org avatar

    There is great momentum in a community that already knows a language and wants to do work with that. (i.e. that is not primarily programming, but merely using programming to achieve some other goal.)

    So, those people will reach for what they already know, which in this case is ; and if it is good enough, then other niche special-purpose tools don't even get investigated.

    A special property of Python is impressive support for so many use cases; people try it, it just works!

    @array

    array,
    @array@fosstodon.org avatar

    @bignose "Yeah, this treatment just works -in most cases, just take it with a grain of salt and fingers crossed. I may have heard about other treatments which more efficiently could treat your specific illness, but what are you asking from me, I'm just a doctor, and a lazy one I'll admit!" XD

    Yeah, I can understand why. I'm just not sure that is the better option. ;)

    bignose,
    @bignose@fosstodon.org avatar

    That's what I tried to clarify though @array; in your analogy, the person is a doctor, expected to have a great deal of knowledge about medical treatments.

    But these people I'm talking about, don't have "programmer" as their profession; they're scientists, or they're financial experts, or they're trying to run a training website, or a bunch of other things. is not their profession, it's a tool in their job.

    And it works well! But they don't need to be expert in all the others.

    array,
    @array@fosstodon.org avatar

    @bignose You're very right, and that's actually part of my point. You wouldn't expect a scientist or financial expert or someone trying to just "run a training website" to prescribe your medical treatments, but nobody wonders why they write code? Just saying, but maybe an actual programmer could come up with better solutions... ;)

    folkerschamel,
    @folkerschamel@mastodon.social avatar

    @array @bignose

    I would also add that there is no right or wrong programming language. At the end you can solve every software engineering problem in any programming language which is turing complete.

    And in practice you usually don't have a choice either, because of an existing code base etc. etc. - it's quite rare to start a new project from the scratch.

    Also don't be afraid of mixing multiple languages within a single larger project.

    array,
    @array@fosstodon.org avatar

    @folkerschamel @bignose Fair enough. But still, SQL may be Turing complete, but I guess it may not be the best choice if you want to write an OS from scratch. Same with using, say, C in full-stack web dev. ;)

    Yet you're right, personal projects apart, in an actual ${job} one likely don't get to choose. I just cross fingers for the choosing made before I jump in were not just a mess, as it happens. XD

    "Best tool for the job" seems like good advice, including mix and match. Thanks! :D

    folkerschamel,
    @folkerschamel@mastodon.social avatar

    @array @bignose

    "SQL may be Turing complete, but I guess it may not be the best choice if you want to write an OS from scratch" -> you and me must be careful, you may trigger me to try to proof the opposite! 😉

    But seriously, yes, I agree definitely, especially with "best tool for the job"🙂

    We originally used mainly . But when we started a complete new tool application and chose . And then, starting major web development, we chose . Three times where we could choose.

    array,
    @array@fosstodon.org avatar

    @folkerschamel @bignose Haha, just reading again what I wrote I thought, "a full OS in SQL seems so, uh, "challenging", that maybe someone already tried that". XD

    In an ideal world everybody would count with very good engineers, reaching for the less bloated, better and funnier to write, best performant, safer, more efficient tools for the job. And etc. Now we just have to wait for someone to write those tools. XD

    array,
    @array@fosstodon.org avatar

    @folkerschamel @bignose (I just remembered now... My professor for Databases made a Goat Race Simulator in SQL and prompted us to do something similar. Because, you know, what DBMS could run without a Goat Race Simulator? XD)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines