[Python-bugs-list] [ python-Bugs-484857 ] print with comma ended

noreply@sourceforge.net noreply@sourceforge.net
Tue, 04 Dec 2001 21:47:02 -0800


Bugs item #484857, was opened at 2001-11-23 05:33
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=484857&group_id=5470

Category: Documentation
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Hernan Martinez Foffani (hfoffani)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: print with comma ended

Initial Comment:
python 2.2a1 on windows 2000 professional, and the 
included IDLE.

the following function prints 'AB' in the command 
line, but 'A B' in IDLE.
should print 'AB' as stated in chapter 6.6 item 3 of 
the Reference manual

def test():
    print "%c" % 65,
    sys.stdout.write("")
    print "%c" % 66

test()



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

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-12-04 21:47

Message:
Logged In: YES 
user_id=3066

Fixed in Doc/ref/ref6.tex revision 1.43.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-11-23 18:07

Message:
Logged In: YES 
user_id=6380

You're right, that's what the docs say. I'm in a predicament
though: I found at least half a dozen places in IDLE alone
where a class defines a write() method in order to be usable
as an output file, and I would have to add "self.softspace =
0" to each of these methods. I'm sure there are tons of
other "file-like objects" (e.g. StringIO and cStringIO) that
also have this same "deficiency" and would have to be fixed
the same way.

I'd rather update the docs to clarify that while this is the
behavior of the standard file object, not all file-like
objects behave this way, and programs shouldn't count on
this.

If you want a reliable way to get rid of the space, assign
zero to sys.stdout.softspace yourself, rather than using
sys.stdout.write("").

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

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