Notes from MPUG, June 2013: “Python one-liners” talk | Curious Venn
Saw this today, interesting and useful.
The page linked above also has links to other pages with more such Python one-liners, including a discussion on StackOverflow.
Many of the Python one-liners shown, use the "python -m" technique, but that's not all there is to it - some of those also show innovative or non-intuitive uses of that technique.
Two of my favorites from the one-liners shown, are the 'e' module on PyPI :-), and the use of the gzip or zip modules on the command-line as a substitute when you don't have access to a native (un)zip or g(un)zip binary/executable, but do have Python available. "Batteries included" wins here.
You can also run simple Internet servers or clients for HTTP, FTP, POP, SMTP, telnet, etc., using the -m option of Python.
These uses of Python one-liners for Internet purposes reminds me of the REBOL language, in which you can also do such things:
http://jugad2.blogspot.com/2012/12/rebol-language-that-influenced-json-is.html
Update: I saw the MPUG Python talk (linked above) via Hacker News, here:
https://news.ycombinator.com/item?id=5814165
and then wrote this post. Just after writing my post, I visited Planet Python and saw that the MPUG post, by Graeme Cross (curiousvenn.com) was already on the planet.
Anyway, I'm not deleting my post.
Update 2: The HN thread also mentions this other list of one-liners on the Python Wiki:
http://wiki.python.org/moin/Powerful%20Python%20One-Liners
(some good ones there too), and that list also mentions PyP, a Python tool by Sony ImageWorks to create hjgh-performance image-processing pipelines. I had blogged about PyP and related Python pipe tools some time ago, and those tools were what gave me the idea to create my pipe_controller project:
http://jugad2.blogspot.in/2011/09/some-ways-of-doing-unix-style-pipes-in.html
http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating.html
http://jugad2.blogspot.com/2012/09/using-pipecontroller-to-run-pipe.html
http://jugad2.blogspot.com/2012/10/swapping-pipe-components-at-runtime.html
https://bitbucket.org/vasudevram/pipe_controller
- Vasudev Ram
dancingbison.com
No comments:
Post a Comment