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."
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."
Of course it's a Unix shell.. (Score:5, Funny)
Re:Of course it's a Unix shell.. (Score:5, Funny)
Because it's a corny idea.
Re: (Score:2)
Re: (Score:2)
And annoyingly spelled "Xonch"
Re: (Score:2)
But it's pronounced "Throat Wobbler-Mangrove."
Re: (Score:3)
I thought having a stalker would be a bit more interesting than this, to be honest.
Couldn't you switch it up a bit?
Re: (Score:2)
I kinda wonder why there isn't a Taco Shell....
Because Mexicans are perfectly happy with bash, mang.
Re: (Score:2)
Re: (Score:2)
The annoying spelling is likely for trademark purposes as you can't trademark a common name without millions to spend on lawyers.
Re: (Score:2)
Re: (Score:2)
I kinda wonder why there isn't a Taco Shell....
the upside down punctuation, while nicely bracketing, IS a pain to type.
also, some verbs have changed:
see_esther(10)
will sleep for 10 seconds.
Re: (Score:3)
Oh wait (Score:3, Funny)
This is awesome! Wait, it's Python 3?
NOOOOOOOO
Re: (Score:2)
So not really a Python/Unix hybrid (Score:5, Informative)
Re:So not really a Python/Unix hybrid (Score:4, Insightful)
Re: (Score:2)
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.
Re: (Score:2)
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.
Great idea! (Score:2)
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
Re: (Score:2)
I'm only pissed that they didn't but in-line ASM in there too :-(
Headline "Python/Unix Hybrid" is misleading (Score:2, Informative)
Unix is not a shell (if it were, we would not need shells) and Xonsh/bash/Python are not operating systems.
Re: (Score:2)
Both?
What the hell (Score:3)
is "Bash Unix"?
Re:What the hell (Score:5, 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!
Re: (Score:2)
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)
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)
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.
Re: (Score:3)
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.
Re: (Score:2)
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.
Re: (Score:2)
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
Re: (Score:2)
That's very similar to my 'bcc' function:
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:
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)
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".
Re: (Score:2)
And shortly after 'subversion' gets traction companies are migrating to GiT (what is the 'meaning' of git btw.?)
Re: (Score:2)
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.
Re: (Score:2)
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.
The name is not a good choice. (Score:2)
Why give it an annoying name that makes it more difficult to communicate?
Python/Unix Hybrid? (Score:2)
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!
Comparable to Fish shell (Score:2)
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
What's with all the complaints about the spelling? (Score:2)
If I want the computer conch and am not interested in seeing a bunch of pictures of shells, I know what to type.
Killer Feature (Score:2)
... 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)
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.
Kind of cool, kind of ugly (Score:2)
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.
Re: (Score:2)
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.
[*]
Enough with the retarded names (Score:2)
"You can do things like add two numbers together" (Score:2)
Whoa.
Wrong Pronunciation (Score:2)
It says right on the homepage:
the xonsh shell
~ It is pronounced zonsch ~
Either way, it's still terrible name.
Shells... (Score:2)
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
What's the point? (Score:2)
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.
Re: (Score:2)
That's okay, I'll have your sloppy seconds.
Re: (Score:2)
Python's not as bad as it could be. It's tedious, but relatively clear. I think it's a fine language for other people to program in.
Re: (Score:2)
Python's not as bad as it could be. I think it's a fine language for other people to program in.
That's faint praise. People said similar things about COBOL. You could always read what someone else wrote ...
Re: (Score:2)
Personally, I would rather lean Cobol than Python, but that is just me.
Re: Python (Score:2)
Pretty sure that's supposed to be something less than praise of any kind.
Re: (Score:2)
... not as bad as it could be...
Wish I could say that about the upcoming election...
"Use 4 spaces per indentation level." (Score:3, Informative)
Like PEP 8 [python.org] 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.
Re: (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
Replace "#1" with ">&0"
Replace "#2" with "<>"
Re: (Score:2)
At this point it looks like either you don't, or you mangle your Python to be purely functional programming. I'm hoping they will enhance the parser to support some simple convention like curly braces. Not Pythonic, but the whole concept is by definition not purely Pythonic
Re: (Score:2)
PEP8 is the codestyle guide for contributing to Python:
It is not relevant for any other code written in Python, although other projects may choose to adopt it too.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
If someone can't manage their whitespace, I wouldn't want them anywhere near real code.
People shouldn't have to worry about and/or manage their white space. That Python cares is a stupid feature of the language. Yes, at some level, it's elegant, but not additionally useful and is more a result of Guido's ego than anything else. The language would be just as powerful, useful and productive using block delimiters but w/o the fucking around with problems caused by a extra or missing space on a line. I'll stick with Perl.
Re: (Score:3)
Re: (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.
That I can definitely agree with.
Re: (Score:2)
I agree, this is the one stupid thing about the language, I definitely prefer white space being completely irrelevant. But everything else about Python fucking rocks, so meh, you get used to it. Honestly I can't remember the last time it was an issue for me, and I use Python A LOT.
Re:Python (Score:5, Interesting)
Re: (Score:2)
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.
You'll also notice how other languages need a semicolon after each line, whereas Python (and Julia, Fortran etc.) understands line breaks. I guess early programming environments had a good reason for cramming multiple statements on one line, but now that we can use line breaks for readability, it might as well be a part of the syntax.
Re: (Score:2)
Re: (Score:2)
You'll also notice how other languages need a semicolon after each line, whereas Python (and Julia, Fortran etc.) understands line breaks. I guess early programming environments had a good reason for cramming multiple statements on one line, but now that we can use line breaks for readability, it might as well be a part of the syntax.
I prefer languages which require statements to be terminated by a semicolon (C, C++, Java, Perl, etc.) — and not because I cram multiple statements onto a single line all the time. I just find it much easier for my mind to parse the syntax. I also prefer poetry that places a period at the end of a sentence rather than making me think about where the sentence ends.
Re: (Score:2)
I also prefer poetry that places a period at the end of a sentence rather than making me think about where the sentence ends.
good point
but if you always put a line break between statements
then a period is redundant
Re: (Score:2)
but if you always put a line break between statements then a period is redundant
Not true. It would still be ambiguous whenever a line wrapped to the next line.
Re: (Score:2)
You prefer the semicolons because that's what you learned with and you've been doing for a while. If you had learned with line breaks, you would prefer it instead. Personally, it's just one less character I have to type virtually every line.
Re: (Score:2)
You prefer the semicolons because that's what you learned with and you've been doing for a while.
You would be wrong on that. I prefer semicolons because they make statements unambiguous.
If you had learned with line breaks, you would prefer it instead. Personally, it's just one less character I have to type virtually every line.
You would be wrong on that, too. I actually did learn coding originally in a language that used line breaks for the end of a statment. When I learned C, and switched to semicolons, it was a breath of fresh air for me.
Re: (Score:2)
I love Python (disclaimer). But semicolons in other languages are more about splitting lines, not combining them, in my experience. That's a nice feature about being white space agnostic. Occasionally, like when splitting a string across multiple lines, you have to escape the line break, but you have to do that in Python as well sometimes, so it's a wash.
Re: (Score:2)
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.
Parentheses != brackets
Just saying.
Re: (Score:3)
Re: (Score:2)
yes, and I meant to say brackets.
Did you also mean to confuse "then" with "than"?
Brackets exist for a good reason (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.
Re: (Score:2)
If a bracket is missing the program won't compile you dork.
Re: (Score:2)
Actually jackass it won't necessarily compile if you delete 2. Delete both brackets from this and see how far you get.
int main() { return 0; }
Aside from that the chances of accidentaly deleting and open and close bracket in the same function and not noticing are vanishingly small. Far less that deleting some whitespace.
Re: (Score:2)
And the really sad part is you still don't understand why Python is fucking retarded for not having them all over the place.
Your whining about 2 characters which make it infinitely more readable.
Congratulations, in 10 years, you'll have enough experience to realize how stupid Python is.
Python does all sorts of stupid shit, it likes to imply via white space changes rather than solid well defined delimiters.
The fact that white space controls program logic and loading it in the wrong editor or a bad copy and p
Re:Python (Score:4, Insightful)
Re: (Score:2)
This is probably the most insightful comment in this whole thread.
Perl (Score:3)
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.
Re: (Score:3)
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
It looks like bash (Score:2)
perl can look rather odd if you are not used to it.
Yes but in this instance it looks like Bash! and Awk and Sed and Grep. So for a shell, the syntax is just like what you are replacing.
Re: (Score:2)
One of the GUI chat clients even uses sed syntax for editing typos in your conversation.
Re: (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 ap
Re: (Score:2)
This was, arguably, the most cohesive and agreeable commentary in this entire thread that I've read so far. No clue why some young farts chose to down-vote it.
I write things in Python right now because I'm trying to learn it. I wrote a cool routine that makes graphs and all, and tried to share it with Management.
The people in charge of routines that are shared among teams here won't touch it because their team doesn't know Python (they seem to be the only team in the company that doesn't), so they can't m
Re: Perl (Score:2)
Perl is not a write only language in any way. If you're looking at write only Perl code it was written by a write only programmer.
I found the expressiveness of the Perl language is something that lets me write more code that does exactly what it looks like it does as idioms or phrases. I don't use Perl idioms for compactness. I use them because it makes my intent clear.
Re: Perl (Score:2)
Why not Zoidberg?!
Re:It's spelled "Luxury yacht" (Score:4, 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.
Like Gnu? (Score:2)
Is a self referential acronym Hipster?
Re: (Score:2)
Is a self referential acronym Hipster?
No .. but calling out as feature is IMHO
Re: (Score:2)
Bash is a poorly designed language, compared to Python. Bash was great a few decades ago, but it is no match to Python's expressiveness and massive libraries.
Re: (Score:2)
Bash was not "designed" at all. It is a hack to bourne sh adding a crazy quilt of spliced-on features while not totally destroying compatibility all the way back to Unix v7.
Re: (Score:2)
It's not pronounced conch, it's pronounced zonsch.
Jesus, seriously? Zonsch? That's even dumber than being pronounced conch. At least if it were spelled Xonsh and pronounced "conch" they could claim that the X is a (chi) like TeX does.
Re: (Score:2)
> Never understood the attraction to the bash cli. Good for scripting, though (when Perl is missing).
Often a lot better than Perl. Perl is a mediocre operating system that lacks a lightweight text-parsing/scripting ability.
Re: (Score:2)
Bzzzt. Sorry, Charlie. Next time you want to render opinion, it might pay to have, or at least make some attempt to acquire, a basic familiarity with the subject matter. Just a suggestion.
Powershell is not even in the same class as xonsh. One of the two is not joined at the hip to the architecture of an oddball operating system. The other one will never make anyone using a real operating system jealous. You
Re: (Score:2)
If this bothers you, how do you think TeX is supposed to be pronounced? Hint: it ain't teks.
My only problem is, are you supposed to pronounce it kontch? Or kongk? The conch shell on the beach is pronounced kongk.
Re: (Score:2)
Well, it turns out the joke's on both of us. The TRUE pronunciation [podcastinit.com] turns out to be zontsh! I figure its creator should know how to pronounce his own creation. The host prnounces it at 01:20 of the podcast, and Anthony Scopatz does NOT correct him. Then Anthony pronounces it the same way at 04:40. Maybe they are both trying to pronounce the leading ks sound, but if so it doesn't matter because it sounds just like zontsh.
Hopefully we can put this "conch" fabrication/bullshit to bed.
There is a frame on a page