".>>>" is a good idea! (OT, was: Re: do you master list comprehensions?)

Steve Holden steve at holdenweb.com
Thu Dec 16 12:00:34 EST 2004


Nick Coghlan wrote:

> Roel Schroeven wrote:
> 
>> Stefan Behnel wrote:
>>
>>> This is the first time I see that and I totally like the idea of 
>>> writing ".>>>" instead of ">>>" at the beginning of a line. Thank you 
>>> Dr. Dobb! It's unfortunate for c.l.py that Python uses ">>>" as the 
>>> default prompt as it messes up the display on mail/news readers that 
>>> provide "syntax highlighting" for quotes.
> 
> 
> I use Thunderbird, and started doing it so I could read my own posts. I 
> did copy it from someone, though (but I can't recall who).
> 
> The trick can also be useful for web tools that strip leading whitespace.
> 
>> Prepending every line with . is not an ideal solution though... I 
>> think it gets tiresome very quickly.
> 
> 
> Aye, can't argue with that. It does have the virtues of reliability and 
> portability, though :)
> 
> Cheers,
> Nick.
> 
$ python
Python 2.4 (#1, Dec  4 2004, 20:10:33)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.ps1 = ".>>> "; sys.ps2 = ".... "
.>>> print """\
.... It isn't that hard"""
It isn't that hard
.>>>

Would it work, I wonder, with a leading space on the prompt? That might 
be a valid change to the standard prompt. Let's see

  >>> This line isn't really quoted three times.

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list