[IPython-dev] %paste

Fernando Perez Fernando.Perez at colorado.edu
Mon Jan 23 15:41:04 EST 2006


Ville Vainio wrote:
> On 1/23/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
> 
> (regarding %paste for pasting code even when autoindent is on)
> 
> 
>>This is not a bad idea at all.  You could even provide the sentinel if you
>>wanted to change it, with a default like '--':
> 
> 
> I'm not sure how useful it would be, because -- at the start of line
> isn't a very useful python statement in the first place.

What if it's in the middle of a triple-quoted string?

print """
hi, this is something

--

and now, here's more..."""
print 2+3

The current paste would truncate this in the middle, since it's not tokenizing 
the input to know that you are inside a string.

That's why a configurable sentinel is a good idea.

Cheers,

f




More information about the IPython-dev mailing list