".>>>" is a good idea! (OT, was: Re: do you master list comprehensions?)
Roel Schroeven
rschroev_nospam_ml at fastmail.fm
Thu Dec 16 07:35:25 EST 2004
Stefan Behnel wrote:
>
> Nick Coghlan schrieb:
>
>>>>>> data = [['foo','bar','baz'],['my','your'],['holy','grail']]
>>>>>> result = []
>>>>>> for d in data:
>>
>>
>> .>>> data = [['foo','bar','baz'],['my','your'],['holy','grail']]
>> .>>> from itertools import chain
>> .>>> result = "".join(chain(*data))
>> 'foobarbazmyyourholygrail'
>
>
> 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.
Off topic, but indeed: I use Quote Colors in Mozilla which is very nice
for reading mails or news posts with quotes, but it's very confusing
with Python's prompt.
Prepending every line with . is not an ideal solution though... I think
it gets tiresome very quickly.
--
"Codito ergo sum"
Roel Schroeven
More information about the Python-list
mailing list