⇤ ← Revision 1 as of 2005-02-05 15:52:24
152
Comment:
|
647
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
---- I don't like the idea of python "one-liners". For instance, in the above example, there are actually 3 statments there: from urllib import urlopen doc = urlopen("http://www.python.org").read() 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
* Grab a document from the `net:
from urllib import urlopen;doc = urlopen("http://www.python.org").read();print doc
I don't like the idea of python "one-liners". For instance, in the above example, there are actually 3 statments there:
from urllib import urlopen
doc = urlopen("http://www.python.org").read() 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?