Differences between revisions 2 and 3
Revision 2 as of 2005-02-06 20:00:59
Size: 647
Editor: rba-cache1-vif1
Comment:
Revision 3 as of 2005-02-06 20:12:34
Size: 667
Editor: rba-cache1-vif1
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
{{{
#!python
Line 13: Line 15:
}}}

Powerful Python One-Liners

* Grab a document from the `net:


I don't like the idea of python "one-liners". For instance, in the above example, there are actually 3 statments there:

   1 from urllib import urlopen
   2 
   3 doc = urlopen("http://www.python.org").read()
   4 print doc

My opinion is that this form is far more readable and clear. I propose that, rather than go for one-liners, rather go for "powerful code snippets", where we don't try to squeeze stuff into one-line just for its own sake. Thoughts on this, anyone?

CalebHattingh


Powerful Python One-Liners (last edited 2023-07-19 19:23:56 by HermannStammWilbrandt)

Unable to edit the page? See the FrontPage for instructions.