[IPython-user] Not breaking a block on an indented line

Fernando Perez Fernando.Perez at colorado.edu
Tue Dec 27 22:39:11 CST 2005


Joshua Gilbert wrote:
> I think that this is a wishlist item, but I'd love to hear that it's
> already possible.

Fixed in SVN.  Note that the behavior is, by necessity, different depending on 
whether autoindent is on or off.  From the changelog:

	WARNING: a behavior change is necessarily introduced to support
	blank lines: now a single blank line with whitespace does NOT
	break the input loop, which means that when autoindent is on, by
	default hitting return on the next (indented) line does NOT exit.

	Instead, to exit a multiline input you can either have:

	  - TWO whitespace lines (just hit return again), or

	  - a single whitespace line of a different length than provided
	by the autoindent (add or remove a space).

This simply means that if you have autoindent on, one extra keystroke (return, 
space or backspace) is now needed to end a multiline input block.  I think 
it's a reasonable price to pay for the major enhancement of functionality it 
brings (the ability to paste arbitrarily large chunks of Python from any 
editor directly into iypthon, provided that all top-level definitions 
--functions, classes, etc-- are separated by TWO blank lines).

If users really find this to be a major annoyance and they complain (or if it 
begins to drive ME crazy after using it for a while), I will consider adding 
an extra config option for this, but I'd rather not.  At least I'll let it be 
this way for a while, and see what the reaction is.

Cheers,

f




More information about the IPython-user mailing list