[Python-bugs-list] [ python-Feature Requests-512497 ] multi-line print statement

noreply@sourceforge.net noreply@sourceforge.net
Wed, 20 Feb 2002 21:37:44 -0800


Feature Requests item #512497, was opened at 2002-02-03 14:15
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=512497&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: frobozz electric (frobozzelectric)
Assigned to: Nobody/Anonymous (nobody)
Summary: multi-line print statement

Initial Comment:
Similar to the multi-line comment block suggestion,
instead of using \ to say the line continues use
print:
<indent>"line 1"
<indent>"line 2"
...
<indent>"line n"

Ok, then...thanks

----------------------------------------------------------------------

>Comment By: frobozz electric (frobozzelectric)
Date: 2002-02-20 21:37

Message:
Logged In: YES 
user_id=447750

I'm just learning Python, so I'm sorry that I didn't know 
that you already have
 
print """
    Large 
    block 
    of 
    text
"""
which is what all I had in mind for

print:
    Large 
    block 
    of 
    text

I still think the latter looks cleaner, but, anyway...
Thanks for your time.  

----------------------------------------------------------------------

Comment By: frobozz electric (frobozzelectric)
Date: 2002-02-17 08:08

Message:
Logged In: YES 
user_id=447750

Well, what I was thinking about was more for when you have 
a large block of text to display, likely with no variables 
to be evaluated. So, your example, using raise and for, 
would not raise an exception nor begin a for loop inside a 
print: block, rather, they would print stdout, i.e.,
print:
    "foo"
    raise "Done"

would display

fooraise Done

print:
    foo\n
    raise Done

would display
foo
raise Done

The use of quotation marks, would likely be superfluous.

I'm not sure how you could cleanly introduce variable 
evaluation into this type of print block. Mostly, I was 
just interested in being able to put several lines of text 
into one print block, as opposed to using \ or several 
print statements.

Thanks


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-02-16 16:19

Message:
Logged In: YES 
user_id=21627

Can you specify more precisely how this feature would work?
E.g. would it be legal to write

print:
   "foo"
   raise "Done"

or

print:
  for i in range(10):
    "bar"

If so, what would be the meaning of the latter one?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=512497&group_id=5470