@JonYoder There are reasons I often reach for the shell for quick-and-dirty things. But for anything serious, it quickly becomes a problem. In the days of Python 2, it was a good replacement, but with Python 3's inability to correctly handle POSIX filenames, environment variables, and parameters, I wouldn't bother. Rust is actually pretty decent for a lot of quick stuff once you get used to it.
@JonYoder I wrote a series of articles on this subject culminating in https://changelog.complete.org/archives/10063-the-fundamental-problem-in-python-3 . In short, I was so burned by my effort to port #pygopherd to #Python 3 -- and the utter crappiness and inconsistency of handling non-UTF8 in even the library bundled with Python -- that I consider it unsuitable for any purpose involving filenames, command-line parameters, or environment variables. One lovely tidbit is the zipfile.py tries to decode non-UTF8 sequences as cp437 in ALL cases!
@JonYoder If you want a coffee with your reading, after that first link, you can check out https://changelog.complete.org/archives/10053-the-incredible-disaster-of-python-3 and https://changelog.complete.org/archives/9938-the-python-unicode-mess . The upshot of it is, as far as I can tell, it is impossible to write cross-platform #Python code that handles filenames correctly on both POSIX and Windows. #Rust gets this right, and Python's attempt to assume the whole world has used #Unicode since the beginning of time is a real pain.
@JonYoder Avoiding #Python - Besides the absurd inconsistencies in https://changelog.complete.org/archives/10053-the-incredible-disaster-of-python-3 and the extreme difficulty verging on the impossibility of properly handling filenames in POSIX (see https://changelog.complete.org/archives/10063-the-fundamental-problem-in-python-3 and https://changelog.complete.org/archives/9938-the-python-unicode-mess ), there is more that makes me shy away. 2/
@JonYoder It is astonishing to me that #Python still has a Global Interpreter Lock in 2022. https://wiki.python.org/moin/GlobalInterpreterLock Multithreading in Python is mostly a fiction. There are kludges like https://docs.python.org/3/library/multiprocessing.html which use fork, pipes, pickling, and message passing to simulate threads. But there are so many dragons down that path -- performance and platform-specific ones (different things can be pickled on Windows vs. Linux) that it is a poor substitute. 3/
@JonYoder When I started using #Python more than 20 years ago now, it was an attractive alternative to Perl: like Perl, you don't have to worry about memory management as with C, but Python code was more maintainable. By now, though, even writing a Unix-style cat command in Python is extraordinarily complicated https://lucumr.pocoo.org/2014/5/12/everything-about-unicode/ . All the "foo-like objects" are an interesting abstraction until they break horribly, and the lack of strong types makes it hard to scale code size. 5/
@JonYoder The one place I still see #Python being used is situations where the #REPL is valuable. (Note, #Haskell also has this). #Jupyter is an example of this too. People use #Python for rapid testing of things and interactive prototyping. For a time, when I had date arithmetic problems, I'd open up the Python CLI and write stuff there. Nowadays it's simpler to just write a Rust program to do it for me, really. 7/
@JonYoder So that leaves me thinking: We're thinking about #Python wrong these days. Its greatest utility is as a shell, not a language to write large programs in. As a shell, it is decent, especially for scientific work. Like other shells, most of the serious work is farmed out to code not written in Python, but there is utility in having it as a shell anyhow. And like a shell, once your requirements get to a certain point, you reach for something more serious. end/
@trevdev @JonYoder I used CL some back in college, and dabble in elisp from time to time, but I'm not expert in either. I found Haskell particularly fascinating as I think it takes the FP paradigm further than even those do (via laziness and segmented side-effects). But Lisps could also serve the REPL need. Maybe someone else would know more (#Scheme is in this universe too, but I'm not fluent in it)
I'm into it mostly to train my brain on something that is not inspired by C. I discovered the Lambda Calculus and that made the exercise even more interesting.
I really like the syntax, it's so simple that other languages seem complicated to read for me now haha
Can feel weird at first but you get used to it : everything is expression (no statement), parentheses is the single expression delimiter, …
I don't leverage the REPL very far but I do use it pretty often.
Imagine a Python program running a Python REPL you can use to load new code to modify/extend the behavior of the Python program while it's running (more powerful than hot reload, https://www.gnu.org/software/guile/manual/html_node/Cooperative-REPL-Servers.html 👋 @dthompson )
@jeko @jgoerzen @JonYoder I am not a stranger to the parens and am in no hurry to get rid of them myself :) I am also trying to expand my mind a bit here. If that expansion can be practical, all the better.
This is part of why I am looking at Clojure(Script?) closer that Scheme or CL, but I would rather get lower level if I can.
@jgoerzen Read your article. I can see why you avoid #Python, especially 3. In this instance, I think *both* Python and POSIX are stupid. By permitting basically everything, the standard makes it *much* harder for developers to do it without breaking on *something*. And Python 2 definitely had a much better thing going on for string type consistency.
@JonYoder Oh you get no argument from me on it being ill-advised for \n, \t, \a, and '-' being valid filenames in POSIX (among many other characters that shouldn't be valid in filenames). Fully in agreement; this has been the cause of many bugs over the years and no doubt will be for many years to come.
@JonYoder I have more sympathy for the lack of a declared encoding in POSIX, since Unix predated Unicode by decades. And historically, mostly it was not possible to have a binary sequence that was somehow "invalid" in a given encoding as it is now with UTF-8 (basically, we used to just select how our terminals would render certain characters; it was more of a font selection than anything). So now with UTF-8, some binary sequences are invalid in UTF-8 but still valid in POSIX.
What an alien thing to say. All you have to do is open up github.com or any job listing website to be proven wrong.
I write this using Qutebrowser on Qtile started from a Xonsh shell - Python is not fit for writing large programs! /s
@Wraptile @JonYoder 1/ I have several responses to that. First of all, popularity does not equal suitability. I would say that, today, C isn't really suitable for writing large programs in. I am perfectly aware that many large programs are written in C; I have worked on them personally and professionally. But factors other than suitability come into play (eg, the high cost of rewriting an existing code base in a new language, institutional inertia, dev team skillset, etc.)
@Wraptile @JonYoder 3/ "Not fit for" != "never used for". Returning to the #C example, I think C is not fit for modern development, now that we have #Rust. That doesn't mean it's impossible to use C, or that nobody does; just that, from a purely technical view, having to manage memory manually and deal with all the other numerous pitfalls of C isn't worth it TODAY. Nobody's going to rewrite Apache in Rust tomorrow, but if somebody were starting a new web server tomorrow, C shouldn't be chosen.
@Wraptile @JonYoder 4/ And so it is here. I don't begrudge people the choices they made in the days before Haskell, Go, and Rust were ready. I made similar choices. I also pointed out some cases where Python was helpful (REPL and interactive prototyping, shell-like uses). I said the GIL was a huge problem in modern computing. Your reply confirmed what I said on both counts, so I'm at a loss as to where the substantive disagreement is. /end
I think python is opposite - it's made to address the human problem of engineering and that's why it's great for "big programs".
@Wraptile @JonYoder You think that economic activity is the measure of quality? Well then, I guess we should have just given up on Linux in 1995 then, because everything from Windows to AIX had more economic activity than Linux.
I absolutely reject the notion that cash equals quality. That notion excludes the possibility of new and better things, because the new will necessarily have less economic activity - that doesn't make it worse. 1/
I can't help but notice that none of your arguments are technical. I'm sorry, but arguments that boil down to "X makes more money than Y" or "X is more popular than Y" are utterly unconvincing in a technical conversation. I have spent most of my life seeing the less-popular solutions be better than the popular ones in material ways.
@Wraptile @JonYoder I am happy to have a conversation with you about the technical merits of different approaches, but if your arguments are all going to be about popularity, I find that irrelevant, unconvincing, and not worth the time discussing. I'm happy to have a technical conversation but would rather spend my time at a keyboard doing something other than arguing about things that don't matter.
@tfb @JonYoder That is a really interesting point. I remember two programming languages, #Perl and #Tcl, that were really hot for awhile, for various reasons. Both went through a sort of boom and then a decline. I wonder what it is about these interpreted languages that caused that effect? I also wonder if we will see it effect more interpreted languages.
@tfb @JonYoder I remember reading the Perl Camel Book with actual excitement - "wow, this is so much easier than C!" And similar writing a GUI in Tcl/Tk nearly 30 years ago now. Today I wouldn't touch either of them. I moved from both of them to Python in the early 2000s, and then from Python to Haskell, OCaml, Rust, etc. after experiencing some issues with scaling Python even in the v2 era. (Now, people are, eg, rewriting #Matrix #Synapse server in non-Python languages for performance)
@tfb @JonYoder One of the things that hit me starting with #Haskell and continuing through #Rust is that rapid prototyping is overrated, and there is a lot to be said for "if it compiles, it is (more) likely to work." I think this has significantly raised my expectations for code quality and reordered how I think about productivity (invest a bit more upfront and spend less time debugging later) C, C++, Java, etc. didn't have that property really.
@jgoerzen I think Test Driven Development provides that assurance, but for real instead of kinda if you squint.
@mike TDD definitely helps, but I guess my experience is that tests don't catch all bugs, compilers don't catch all bugs, and the more bug-catching tools you can have in your toolbox the better.
@jgoerzen There’s also lint available for most interpreted languages and sophisticated configuration environments
@jgoerzen @tfb @JonYoder I felt the same way; I think in both of these cases it's that the languages do some small (but important) things well, but then lack bottom. Tk is still the nicest toolkit I've ever used in some ways (lack of modern widgets notwithstanding), but it's freaking hard to use it for large programs because Tcl's data types suck. Ditto for perl and text slicing.
I think you could argue that Ruby and now JS is starting to hit that cycle now too. That's not to say either is dead or really dying, just that they're not the hype language any more (Now it seems to be Rust.)
That being said, Perl is enjoying a nice renaissance at the moment. It's nowhere near its glory days but it has an active community that are working on it regularly and adding new features.
Re: Rust yeah that seems to be the "hot new thing" at the moment. We're at the "everything must be re/written in it" stage of the hype cycle right now.
For people who care about, support, or build Free, Libre, and Open Source Software (FLOSS).