Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Python Programming Unix Linux

Python/Unix Hybrid Demoed at PyCon (xon.sh) 181

A new shell "combines the Python language with features of Bash Unix and the fish and zsh shells," according to InfoWorld. An anonymous reader writes: Pronounced "conch," but spelled Xonsh, it runs on Linux, Windows, and Mac OS X systems, bringing Python libraries to the command line -- for example, the ability to use regular expressions when globbing files. "The first thing you'll notice about Xonsh is that it's really meant to be used as a general-purpose shell," the lead developer explained in a presentation at PyCon. "But on the other hand, it really is Python, so you can do things like add two numbers together."

They're describing it as "a Python-ish, BASHwards-looking shell language and command prompt...a superset of Python 3.4+ with additional support for the best parts of shells that you are used to, such as Bash, zsh, fish, and IPython...the superglue that bonds Python to a command-line interface and other shells."

This discussion has been archived. No new comments can be posted.

Python/Unix Hybrid Demoed at PyCon

Comments Filter:
  • by freeze128 ( 544774 ) on Saturday June 04, 2016 @09:37AM (#52248189)
    It's cleverly named "conch", like the history of other shells (Korn shell, Bourne Shell, Bourne Again Shell (BASH), C Shell). I kinda wonder why there isn't a Taco Shell....
  • Oh wait (Score:3, Funny)

    by Anonymous Coward on Saturday June 04, 2016 @09:48AM (#52248221)

    This is awesome! Wait, it's Python 3?

    NOOOOOOOO

  • by rminsk ( 831757 ) on Saturday June 04, 2016 @09:57AM (#52248245)
    Why is the title of this article "Python/Unix Hybrid Demoed at PyCon" when it is a Python/Bash hybrid? Bash != Unix
    • by dbIII ( 701233 ) on Saturday June 04, 2016 @10:27AM (#52248345)
      It's a beige box is the "hard drive" or a operating system means solitaire game but not device drivers moment - just live with the feeble redefinitions of those that never learned the real definition.
    • by gnupun ( 752725 )

      But bash is the de facto interface for Unix. When there's bug in the Windows UI, do you call it a bug in the Windows GDI or Windows UI? No, you call it a Windows bug.

    • by HiThere ( 15173 )

      This seems a reasonable place to mention that there's nothing remarkable about a Python shell. There have been Ruby and Scheme shells for years, perhaps decades.

      It *IS* a bit unusual that it's cross-platform, but somehow the summary didn't emphasize that.

  • This is such a great idea. I've always wanted to remove the separation between simple execution scripts and complex code which is difficult to understand. it really bugs me that we have these "standards" which simplify portability and make things clear.

    Ideally in a few years, we will have inscrutable, half-assed code all over the execution space. This will give people the opportunity to learn python so they can debug simple execution wrappers. EXCELLENT!

    But if it's not ready yet, we don't have to wait f

    • by Anonymous Coward

      I'm only pissed that they didn't but in-line ASM in there too :-(

  • by Anonymous Coward

    Unix is not a shell (if it were, we would not need shells) and Xonsh/bash/Python are not operating systems.

  • by dnaumov ( 453672 ) on Saturday June 04, 2016 @10:10AM (#52248295)

    is "Bash Unix"?

    • by U2xhc2hkb3QgU3Vja3M ( 4212163 ) on Saturday June 04, 2016 @10:32AM (#52248361)

      What is "bash unix"? I'll show you:

      Unix fucking sucks! There's no games on it and you can't even run Microsoft Office 365 even if you're willing to pay for it every fucking year!

      • I guess you wanted to make a joke, but actually there are plenty of games on Unix, after my Apple ][ I played only a few games on Macs and then mostly on Unix, like XConq, one of the best turn based strategy games ever. It took minimum 6 or 8 more years that I finally played War Craft 2 and Decent on Windows, and ofc. Doom. Actually I only played a few classics like Half Life, Command and Conquer and Diablo and World Of Warcraft.

  • Not excited (Score:5, Insightful)

    by fph il quozientatore ( 971015 ) on Saturday June 04, 2016 @10:23AM (#52248331)
    1. What is so awesome about adding two numbers in the shell?
    2. In any case, bash can do it too -- try echo $((15+7)).
    3. One of the selling points of bash is that it needs to be fast for power users, so it uses cd instead of change_directory(). One of the selling points of Python is that readability counts, so it would choose change_directory() over cd. How do you plan to reconcile the two approaches?
    • Re:Not excited (Score:4, Interesting)

      by DoofusOfDeath ( 636671 ) on Saturday June 04, 2016 @11:23AM (#52248541)

      1. What is so awesome about adding two numbers in the shell?
      2. In any case, bash can do it too -- try echo $((15+7)).
      3. One of the selling points of bash is that it needs to be fast for power users, so it uses cd instead of change_directory(). One of the selling points of Python is that readability counts, so it would choose change_directory() over cd. How do you plan to reconcile the two approaches?

      I haven't checked out Xonsh much yet, but I'm stoked if it provides a good hybrid of Bash and Python.

      Lately I've done a lot of Bash scripting, and I've found myself wanting a few features from Python. The first that comes to mind is wanting Python's ability to have lists / dictionaries that can contain other lists / dictionaries. Bash's associative / indexed arrays are a great feature, but it's very inconvenient to compose them in such a manner, and that occasionally makes my life more difficult.

      OTOH, I haven't wanted to migrate the scripting to Python, because I really like how easy it is to refine and reuse the same command back and forth between a Bash script and a Bash command-line.

      If Xonsh can help in cases like mine, and it manages to gain widespread traction, I'll be stoked.

    • 1. What is so awesome about adding two numbers in the shell? 2. In any case, bash can do it too -- try echo $((15+7)).

      Bash only does integer arithmetic, and grownups generally need floating point math. I usually have a Python or Julia shell open for a variety of reasons, including the "desk calculator" aspect, which BTW might include things like sin/cos, log etc.

      • Bash only does integer arithmetic, and grownups generally need floating point math.

        True, but having bash do it would just be redundant with bc. Try echo "1.64*9.38" | bc.

        I use this function in my bash scripts to do floating point math with bc:

        function calc {
        echo "scale=8; $1" | bc
        }

        Usage: calc 1.64*9.38

        Set your scale and other options to suit.

        • Good point, I was going to mention something about bc or awk, both of which I use in shell scripts, but I thought this discussion was more about interactive use. Though your "calc" might be nice in .bashrc, for example.

          I actually prefer awk in shell scripts for a couple of reasons. First, it seems to be more widely available -- minimalistic distros don't include bc by default, but awk is always there. Also, it's a more complete programming language rather than a calculator. For example, linear regression

        • by theCoder ( 23772 )

          That's very similar to my 'bcc' function:

          bcc() { echo "$*" | bc -l; }

          Great minds, huh? :)

          The advantage to -l is that it defines things like s() and c(), sine and cosine. It also sets the scale to be long. Passing all the arguments makes it easier to do things like:

          bcc 1 + 2 + 3 + 4 + 5

          without having to put it in quotes. The only time I have to use quotes is if I want to use parenthesis in the expression, since the shell would otherwise interpret those. You do have to be careful not to have any bare

  • Say what? (Score:2, Insightful)

    by Anonymous Coward

    Pronounced "conch," but spelled Xonsh

    How about NO?

    This is yet another example of stupidity in the open source community. You don't get to define how a word sounds. The way you write it defines how it's said.

    And even if you say "Xonsh", it sounds stupid anyway.

    There's a reason people don't use "GIMP" in businesses. Nobody can go see his boss and asks to replace Photoshop by "GIMP".

    • And shortly after 'subversion' gets traction companies are migrating to GiT (what is the 'meaning' of git btw.?)

    • Nobody can go see his boss and asks to replace Photoshop by "GIMP".

      maybe if you learned to say "replace Photoshop with "GIMP", your boss might listen to you. Acting illiterate probably does not enhance your reputation as a source of advice.

    • by jwdb ( 526327 )

      This is yet another example of stupidity in the open source community. You don't get to define how a word sounds. The way you write it defines how it's said.

      Right, because English is so consistent in its link between spelling and pronounciation.

      Night, knight, fox, faux, through, thorough, "the dove dove into the bushes"... I could go on for a while. English is *dominated* by words pronounced without regard to the spelling.

  • "Pronounced "conch," but spelled Xonsh, ..."

    Why give it an annoying name that makes it more difficult to communicate?
  • Unix [wikipedia.org] is a family of OSes, Python [wikipedia.org] is an interpreted language.
    How can a command line shell be a hybrid between an OS and a language?
    You insensitive GUI clod! ^C^C^C^D!

    P.S.
    PySh whould have been a much better prank, at least in Italian!
  • This is a really nice shell. From it's features it's basically comparable to Fish shell. It's probably not compatible to the Bourne shell, so not really good to execute Shell scripts. But the same is true for Fish.

    What I am missing is a good type system and a possibility to exchange data between processes in a way that is more structured than plain text. For the moment it is really hard to even put the output of ls into any other process in a reliable way

  • If google had spelled the name of their "go" language "ggo" or something, it would be a hell of a lot easier to... google.

    If I want the computer conch and am not interested in seeing a bunch of pictures of shells, I know what to type.

  • ... you can do things like add two numbers together.

    You mean like I was doing with /bin/sh 25 years ago?

  • Conch = 'Konk' (Score:2, Insightful)

    by itomato ( 91092 )
    People xonshtantly mispronounce these things.
    Quay.io? It's not "kway", it's "key".
    "Conch" isn't fucking "konsh", it's "konk". Like the devs need on the fucking head.
  • More info here: http://xon.sh/ [xon.sh]

    Some of it looks really cool, python + sh is a great idea. Though some of it looks ugly (http://xon.sh/bash_to_xsh.html), the alternative to '$?' for example.
    • by fnj ( 64210 )

      In sh, $? is the return value of the last command. And yeah, __xonsh_history__.rtns[-1] is pretty verbose as well as ugly. The FAQ could use a lot of improvement, though. Here, for example, it could point out that _.returncode also gives you the return value of the last command.[*]

      You could also just define yourself a convenience function:
      def rc():
      return _.returncode
      and then you could just use rc() in place of $?. Unfortunately AFAIK there's no way to avoid the empty parentheses in python.

      [*]

  • You want to pronounce it 'conch', then spell it that way. Not starting with a consonant pronounced like a 'z'. Enough with the cutesy brain damaged fucking names.
  • It says right on the homepage:

            the xonsh shell

    ~ It is pronounced zonsch ~

    Either way, it's still terrible name.

  • Does the author of this posting not realise that "UNIX" isn't the same as bash or whatever you use for you login shell? Anyway, in UNIX (incl. Linux), you can use anything as a login shell, including less productive commands like "/sbin/shutdown -r" and "/usr/games/sl". This is not unique to UNIX, BTW - I once worked with an IBM product called AS, which had a fascinating command that could log you out and then log in as a different user; well, I say different - this included the same user, of course. You co

  • I love python, I love bash and shell scripting, but why would I want this? I usually just start a python shell if I want python's more advanced string parsing.

...there can be no public or private virtue unless the foundation of action is the practice of truth. - George Jacob Holyoake

Working...