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

3 of 181 comments (clear)

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