">>>" and "..." (WAS PEP 359: The "make" Statement)

Steven Bethard steven.bethard at gmail.com
Fri Apr 14 11:57:03 EDT 2006


Felipe Almeida Lessa wrote:
 > Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu:
 >> [1] Here's the code I used to test it.
 >>
 >>  >>> def make(callable, name, args, block_string):
 >> ...     try:
 >> ...         make_dict = callable.__make_dict__
 >> ...     except AttributeError:
 >> ...         make_dict = dict
 >> ...     block_dict = make_dict()
 >> ...     exec block_string in block_dict
 >> ...     return callable(name, args, block_dict)
 >> ...
 >>  >>> (snip)
 >
 > I think it would be nice not to put those ">>>" and "..." to make copy
 > and paste easier. Okay, I know we can do "".join(line[4:] for line in
 > text), but that's just my humble opinion.

Depends what you're copying and pasting to.  In PythonWin, you have to 
have the "... ", so I include it.

If you have an editor with block-select, you should just be able to 
select the appropriate section (ignoring the first four characters). 
TextPad is one such editor (on Windows), but I'm sure there are many 
others and hopefully if you're on Unix someone here can let you know 
what works there.

STeVe



More information about the Python-list mailing list