[IPython-User] history, erratum

Robert Kern robert.kern@gmail....
Mon Mar 14 11:25:48 CDT 2011


On 3/12/11 7:59 PM, Fernando Perez wrote:
> On Fri, Mar 11, 2011 at 11:18 AM, Robert Kern<robert.kern@gmail.com>  wrote:
>>
>> Not in the 0.10 series. That branch's history only records by line, not by
>> block, so that information is simply lost. In 0.11, we do record history by
>> block, but we currently add it back to readline by line. I'm not sure why we do
>> this; it may be unintentional. I would agree that I would prefer it to be by
>> block. Perhaps that could be configurable.
>
> I think I wrote that code... I decided to make it line-by-line because
> I find editing multiline blocks in readline so incredibly annoying as
> to be more or less useless.  But I can see others preferring the
> alternative, so making it configurable would probably be a good idea.
> The alternative implementation isn't particularly difficult, pull
> requests welcome :)  It's just a matter of:
>
> - feeding the blocks instead of the individual lines in
> populate_readline_history():
>
> https://github.com/ipython/ipython/blob/221c7c68700927d5704a9584424c3c6e76ad5305/IPython/core/history.py#L130
>
> - making the above choice based on a configuration flag, that needs to
> be added to the config system (that's actually more work than the
> functional change above).

Ideally, the behavior would be consistent between in-session and 
previous-session history, and could be configured for both to either setting. I 
don't see any place in the code that adds the in-session inputs to the history, 
but I do remember the behavior changing from by-line to by-block a couple of 
years ago.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the IPython-User mailing list