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.

Incorrect.

>>> exec "x=1\0while x < 5:\0  x+=1\0print x".replace('\0','\n')
5

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.




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to