logoalt Hacker News

lynndotpyyesterday at 10:11 PM1 replyview on HN

I think we're talking past each other. You are largely not understanding the point I'm saying. I agree that Python, as a shell and scripting language, will have different ergonomics and tradeoffs compared to Bash.

The point I am making is that, of the listed languages, Python is far more comparable to Bash than the others. Suppose you had no choice but to use one of the following executables in place of /usr/bin/bash

- go - gcc - rustc - node - python

You would choose Python, of course. Plausibly node, but certainly not any of the other three.


Replies

amiga386yesterday at 11:12 PM

OK, but you to admit "largely replace bash with the Python REPL" is something of a stretch.

I didn't read the list of languages given by the earlier poster as specific list, I read them as "<list of random programming languages that aren't shells>". And sure, a scripting language is closer to a shell than a compiled language, but I wouldn't say either Python or Node treat shell commands as first-class citizens, as fellow scripting languages Perl and Ruby do... and even the I wouldn't use Ruby or Perl REPLs as shells, because they're still actually programming languages, not text-based user interfaces to your OS.

    Perl:   $x = `ls -l`;
    Ruby:   x = `ls -l`
    Python: import subprocess; x = subprocess.run(args=["ls", "-l"], capture_output=True).stdout
    Node:   let x = (await require('util').promisify(require('child_process').exec)("ls -l")).stdout