print with no newline

Tim Golden tim.golden at
Fri Sep 3 17:43:42 CEST 2004

| Tim Golden wrote:
| > [Jp Calderone]
| > | Basically, print is only meant to help people new to the 
| > | language get started ;)  
| > | It often does what will make life easiest for someone who is 
| > | just getting into things, but which is otherwise 
| confusing, expected, 
| > | special-casey, or otherwise undesirable.  I mean, the whole 
| > | existence of the keyword "print" is an inconsistency, right?  
| > | One could quite reasonably expect print to be a function.
| > 
| > This point of view comes up from time to time on the list
| > and for the life of me I can't buy into it. Putting aside
| > the obviously tongue-in-cheek implication that only beginners
| > would use print, I have almost never found print to be
| > "confusing... or otherwise undesirable". It does exactly
| > what I expect it to do with the minimum of syntactic clutter.
|    Have you ever run into or relied on the behavior that started this 
| thread?  I can't imagine how you might deduce that behavior from the 
| rest of print's behavior.

All right, I'll admit... I jumped into this mid-thread, something
that always pains me when other people do it.

|    Let me also clarify - I use print all the time.  It's quite 
| convenient and rarely does something other than what I intend.  That 
| said, almost all my uses of it are for debugging or in the 
| interactive 
| interpreter when investigating some object or behavior.  I can't 
| remember the last time I left it in a real program.

Maybe there's the difference. I use it all the time (well,
reasonably often) in real programs and will no ill-effects
so far, so maybe I'm more (read: too) sensitive when it's

| > [snip]
| > 
| > I would *not* reasonably expect print to be a function. Why
| > should it be? Certainly any move to remove the print statement
| > from the language or to replace it by a print function would
| > get my thumbs-down (or whichever way round the Romans did it).
| > 
|    Lots of other people expect it to be a function.  I can't 
| count the 
| number of times I've read this in someone's code:
|      print(x)

Might be a question of background: I wouldn't dream of writing
print (x). (Background: BASIC, Modula-2, C, C++, SQL, Python and
sundry others I don't mention). I was really taking issue with 
the "reasonably expect" bit, which seemed a bit too universal.
No intention to bite anyone's head off.

|    That said, I don't propose changing it.

Good. That's a relief.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list