What python can NOT do?
steve at REMOVE-THIS-cybersource.com.au
Sat Sep 5 05:13:22 CEST 2009
On Fri, 04 Sep 2009 08:21:15 -0700, Mike Coleman wrote:
> It is true, though, that Python
> cannot be used to write arbitrarily complex one-liners, though.
>>> exec "x=1\0while x < 5:\0 x+=1\0print x".replace('\0','\n')
Take (almost) any arbitrary piece of Python code. Replace all newlines by
nulls. Escape any quotation marks. Wrap the whole thing in quotes, and
pass it to exec as above, and you have an arbitrarily complex one-liner.
More information about the Python-list