Slashdot Mirror


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

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."

26 of 181 comments (clear)

  1. Of course it's a Unix shell.. by freeze128 · · Score: 4, Funny

    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....

    1. Re:Of course it's a Unix shell.. by Anonymous Coward · · Score: 5, Funny

      I kinda wonder why there isn't a Taco Shell....

      Because it's a corny idea.

    2. Re:Of course it's a Unix shell.. by TitusC3v5 · · Score: 2

      I'm still waiting for my Command Line Arguments and Management shell.

      --
      And the masses cried out, "09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0!"
    3. Re: Of course it's a Unix shell.. by wonkey_monkey · · Score: 2

      I thought having a stalker would be a bit more interesting than this, to be honest.

      Couldn't you switch it up a bit?

      --
      systemd is Roko's Basilisk.
  2. Oh wait by Anonymous Coward · · Score: 3, Funny

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

    NOOOOOOOO

  3. So not really a Python/Unix hybrid by rminsk · · Score: 5, Informative

    Why is the title of this article "Python/Unix Hybrid Demoed at PyCon" when it is a Python/Bash hybrid? Bash != Unix

    1. Re:So not really a Python/Unix hybrid by dbIII · · Score: 3, Insightful

      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.

  4. Headline "Python/Unix Hybrid" is misleading by Anonymous Coward · · Score: 2, Informative

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

  5. Perl by goombah99 · · Score: 2

    Many people know that Perl is spelled "perl" and not pearl, but a lot of people don't know it's pronounced "Gob gipple fish waddle". So if you have been wondering while real perl monks ignore you when you ask a question about perl now you know.

    Seriously, if you want a shell with magic powers just use perl. it's exactly what it was originally built for. It is wood chipper to pythons battery powered hedge trimmer when it comes to sysadmin tasks. It's the ideal sys admin and glue language.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:Perl by TheGratefulNet · · Score: 2

      perl can look rather odd if you are not used to it. even with years of comp sci experience, if you don't know perl, you can't always read it. and reading/patching/fixing is important.

      python is much more readable even to the point of going too far (insisting on that space stuff). you can write python that 'looks odd' to non-python people, quite true; but it does not come close to the 'huh???' factor that I and many others have when looking at 'tight' perl code. perl is a write-only language, in some ways. I don't prefer those (really hard to get the data back from write-only things, lol)

      perl used to be 'it' before python. you had to know perl to do that level of scripting, and sysadmins had to deal with it. now, its not so obvious that it -has to be- perl, if its a new project. not at all obvious, and python now usually gets the pref over perl for new things.

      --

      --
      "It is now safe to switch off your computer."
    2. Re:Perl by Anonymous Coward · · Score: 2, Interesting

      perl is a write-only language, in some ways.

      Only if you're in a particularly abstract mood that day..

      If I'm writing Perl code for other people, then I tend to lay it out as if I was writing Pascal code (for I am old, bald of pate, grey of hair and beard and learned to program in FORTRAN, ALGOL and Pascal on mainframes..and some really old habits die hard). It's readable, and I tend to comment the hell out of it.

      If I'm writing it for myself, then all bets are off...I have simple 10-60 liners which are fairly understandable, requiring maybe only the application of a couple of glasses of single malt to trigger the old grey matter (my excuse, and I'm sticking to it), there are, however, a couple of bits of code running into several hundred lines of whisky and/or rum inspired Perl code lurking on one of my machines which I really quite don't understand now, oh sure, the individual routines are readable and make sense, but the overall package...well, it collects and munges data from several devices, logs it, then produces pretty graphs..I wrote it all, it works (ran for seven years without a break, only restarted as I needed to upgrade the hardware), but I'll be buggered if I know exactly how it does what it does though..There are comments in the code, but they're scatological, sarcastic and usually nothing to do with the code they're above and beside..

      At least Perl's not as cryptic looking as APL, now that was a fun language to try learn sans the proper keyboard..

      As to Python, every time I start coding something in Python just for the hell of it, the thought 'I can do this a lot easier in Perl pops up' so I usually do, I can debug other peoples Python code (which I'm about to do into in a couple of hours), but hate programming in it myself..

  6. Re:It's spelled "Luxury yacht" by OzPeter · · Score: 3, Funny

    What is it with all this "it's spelt this way, but pronounced that way" stuff?
    Just give it a not-so-clever name nobody cares.

    Hipsters. As indicated by them taking the effort to call out "Pun in name" as being a distinguishing feature.

    --
    I am Slashdot. Are you Slashdot as well?
  7. What the hell by dnaumov · · Score: 2

    is "Bash Unix"?

    1. Re:What the hell by U2xhc2hkb3QgU3Vja3M · · Score: 4, Funny

      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!

  8. Re:Great idea! by Anonymous Coward · · Score: 2

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

  9. Not excited by fph+il+quozientatore · · Score: 4, Insightful

    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?

    --
    My first program:

    Hell Segmentation fault

    1. Re:Not excited by DoofusOfDeath · · Score: 3, Interesting

      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.

    2. Re:Not excited by TeknoHog · · Score: 2

      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.

      --
      Escher was the first MC and Giger invented the HR department.
  10. Say what? by Anonymous Coward · · Score: 2, Insightful

    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".

  11. "Use 4 spaces per indentation level." by Anonymous Coward · · Score: 3, Informative

    Like PEP 8 clearly says,

    Use 4 spaces per indentation level.

    That's it. That's all there is to it. It's simpler and clearer than the rules for just about every other programming language out there.

    Anyone who can't handle using 4 spaces is a lost cause.

    1. Re:"Use 4 spaces per indentation level." by nullchar · · Score: 2

      How do you write a shell one-liner in Xonsh if you need to use whitespace instead of curly braces and semicolons?


      # one line HTTP check in bash
      { echo -e "GET / HTTP/1.1\nHost: reddit.com\nConnection: close\nAccept: text/html\nUser-Agent: Mozilla/5.0\n" #1; while read LINE; do echo "$LINE"; done; } #2 /dev/tcp/198.41.208.140/80

      Replace "#1" with ">&0"
      Replace "#2" with "<>"

  12. Re:Python by fluffernutter · · Score: 4, Interesting

    I develop in python, java, and objective-c... you know what I hate more then python? Putting parenthesis around every single conditional statement. Once you work in python for awhile and go back, you start to notice how many brackets there are in the other languages.

    --
    Laws are rules for the court, but merely a bottom bar to hit for life. Think beyond laws in your actions always.
  13. Re:Python by mattventura · · Score: 2

    Let me rephrase that: if someone can't keep indentation straight, especially with the fact that an editor is doing most of the work anyway, I wouldn't want them checking in code for any language regardless of whether the white space was syntactically significant or not.

  14. Re:Python by fluffernutter · · Score: 2

    yes, and I meant to say brackets. Am I not allowed to increase the scope of my comment in the next sentence?

    --
    Laws are rules for the court, but merely a bottom bar to hit for life. Think beyond laws in your actions always.
  15. Brackets exist for a good reason by Viol8 · · Score: 5, Informative

    They clearly define the block no matter how you format it.

    More than once I've seen a python program where someone has accidentaly deleted tabbed whitespace on a end line in a block and moved that line into the outer block and of course python says nothing. But now the program is broken. Try removing a bracket in C/C++/java and see what happens.

    Whitespace as a block delimiter is a retarded idea, always has been, always will be.

  16. Re:Python by fluffernutter · · Score: 3, Insightful

    Yeah I can't really get that excited about a programming language either way. I just use the tool for the job.

    --
    Laws are rules for the court, but merely a bottom bar to hit for life. Think beyond laws in your actions always.