do python's nifty indentation rules spell the death of one-liners?

Peter Hansen peter at engcorp.com
Wed Apr 16 08:48:13 EDT 2003


"Greg Ewing (using news.cis.dfn.de)" wrote:
> 
> Oops, looks like I spoke too soon, because this
> *doesn't* work:
> 
> all:
>         python -c '\
>         print "Hi"\
>         for i in range(10):\
>           print i'
> 
> It seems that make puts the whole command on one line,
> no matter how you lay it out in the Makefile. Bugger.

Changing the enclosing quotes to triple-quotes, or explicitly
specifying newlines via \n is required... in this case and
any other with strings split across multiple lines but where
you need to preserve the newlines.

-Peter




More information about the Python-list mailing list