MSH (shell)

Paddy paddy3118 at netscape.net
Fri Oct 28 03:50:45 EDT 2005


Thanks, I'm enjoying reading the article.
So far I noticed how their select functionality is similar to our
comprehensions, but can also take a statement block. ( no wars please
;-).

I liked the tabular output format for lists of similar items, with the
automatic headings being displayed, e.g:
msh> get-childitem | select name, extension, {
  if ($_.LastWriteTime.year -lt 2004) { "old file" }
  else { "new file" }
}

Name                       Extension                  if
($_.LastWriteTime.year...
----                       ---------
-------------------------
examples.txt               .txt                       new file
output1.html               .html                      old file
output2.html               .html                      old file
somefile.doc               .doc                       new file


I tend to avoid xml but their xml example below was succinct and
relatively painless. Do python libraries allow a similarly readable
version of their:

  msh>   $x = [xml]"<zoo><animal
kind='monkey'><name>Albert</name></animal></zoo>"
msh> $x.zoo.animal

kind                                    name
----                                    ----
monkey                                  Albert

Their "Extract the title and author elements from every item in the
rss.channel tag" example is also impressive.

Looks like an innovative new shell.

- Paddy.




More information about the Python-list mailing list