Re: pre-PEP: Print Without Intervening Space

2005-03-15 Thread Antoon Pardon
Op 2005-03-11, Marcin Ciura schreef [EMAIL PROTECTED]: Moreover, all of them require creating one or two temporary objects to hold the entire result. If the programmers use one of them without qualms, it is only because their mind is warped by the limitation of print.

Re: pre-PEP: Print Without Intervening Space

2005-03-12 Thread Marcin Ciura
Steve Holden wrote: You could think about teaching them the linelist.append(fn(x)) way, which then gives you the choice of .join(linelist) - no gaps \n.join(lienlist) - one item per line .join(linelist) - spaces between items. Sure I will. Next week, when we come to list operations.

Re: pre-PEP: Print Without Intervening Space

2005-03-12 Thread Marcin Ciura
Bengt Richter wrote: BTW, what makes you think any self-respecting scientist wouldn't be insulted by the idea of your spoon-feeding them a dumbed-down programming equivalent of See Spot run? Am I right thinking that your dream 3 R's curriculum starts with Stately, plump Buck Mulligan and Plya

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Duncan Booth
Marcin Ciura wrote: None of the more efficient solutions is particularly straightforward, either: result = [] for x in seq: result.append(fn(x)) print ''.join(result) print ''.join([fn(x) for x in seq]) print

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Marcin Ciura
Duncan Booth wrote: import sys def nospace(value, stream=None): '''Suppress output of space before printing value''' stream = stream or sys.stdout stream.softspace = 0 return str(value) I'm teaching Python as the first programming language to non-computer scientists. Many of the

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Larry Bates
Marcin Ciura wrote: Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version: $Revision: 0.0 $ Author: Marcin Ciura marcin.ciura at polsl.pl Status: Draft

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Marcin Ciura
Larry Bates wrote: I fail to see why your proposed solution of: for x in seq: print fn(x),, print is clearer than: print ''.join([fn(x) for x in seq]) Thank you for your input. The latter form is fine with me personally, but you just can't explain it to complete novices. My

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Bill Mill
On Fri, 11 Mar 2005 10:00:03 -0600, Larry Bates [EMAIL PROTECTED] wrote: I also don't miss a no-space option on print. I've always believed that print statements with commas in them were for simple output with little or no regard for formatting (like for debugging statements). If I want

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread John Roth
I'm against further tinkering with Print on a number of grounds, not least of which is that it's going away in Python 3.0. It seems like wasted effort. I don't see much difficulty with the current behavior: if you want to get rid of the spaces, there are alternatives. I don't buy the novice

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Steve Holden
Marcin Ciura wrote: Duncan Booth wrote: import sys def nospace(value, stream=None): '''Suppress output of space before printing value''' stream = stream or sys.stdout stream.softspace = 0 return str(value) I'm teaching Python as the first programming language to non-computer

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Marcin Ciura
In view of Duncan's response, which invalidates the premises of my proposal, I announce the end of its short life. I will add Duncan's solution to my bag of tricks - thank you! Marcin -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Bengt Richter
On Fri, 11 Mar 2005 10:59:16 -0500, Steve Holden [EMAIL PROTECTED] wrote: Marcin Ciura wrote: Duncan Booth wrote: import sys def nospace(value, stream=None): '''Suppress output of space before printing value''' stream = stream or sys.stdout stream.softspace = 0 return