Antoon Pardon <[EMAIL PROTECTED]> wrote:
> For instance if I do the following
>a = 1,
> I have assigned a one element tuple to a.
> But if I do
>print 1,
> It doesn't print a one element tuple.
And if you do
parrot(1,)
you won't call parrot() with a one-element tuple eit
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.
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 Póly
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
scient
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.
.
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.softspac
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
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
scient
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 argueme
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 wa
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 prop
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
> Status: Draft
> Type: Standa
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 toy
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])
>
> pr
14 matches
Mail list logo