Again: Please hear my plea: print without softspace

Dang Griffith noemail at noemail4u.com
Fri Mar 5 13:35:01 CET 2004


On Thu, 04 Mar 2004 22:37:17 +0000, Stephen Horne
<steve at ninereeds.fsnet.co.uk> wrote:

>On Thu, 04 Mar 2004 12:52:27 GMT, Dang Griffith
><noemail at noemail4u.com> wrote:
>
>>On Tue, 02 Mar 2004 10:32:35 -0700, David MacQuigg <dmq at gain.com>
>>wrote:
>>
>>>The 'print' statement is just shortcut for 'sys.stdout.write' with
>>>some convenience features suitable for most users.  If you need
>>>something else, just define your own shortcut, don't deprecate a
>>>statement that is exactly what most users want.
>>
>>'print' is not a shortcut for 'sys.stdout.write'.
>>'print' is a statement.  'sys.stdout.write' is a function.
>>You can't define a shortcut for a statement.
>>    --dang
>
>To the best of my knowledge, the word 'shortcut', is in common
>idiomatic use in English and refers to a quick and convenient means of
>achieving the same goal, by obvious analogy to the literal meaning of
>shortcut as a route to a given destination which is shorter than the
>normal route.
>
>The fact that in this case the means happens to be a statement as
>opposed to a function doesn't seem relevant to me. And the fact that
>programmers cannot define their own custom shortcuts in this way seems
>equally irrelevant.

I understand your idea.  However, the difference between a statement
and a function is exactly my point, and I see it as relevant--if any
language change is to come from this discussion.  New functions can be
added via modules, and do not require changes to the language itself.
New statements require changes to the language itself, which is what
the OP is asking for.  

The [in]ability to define "custom shortcuts", with regards to
statements, is especially relevant because Python doesn't support it.
Other languages do (Ruby?  et al), so someone thinks it's relevant.
It's relevant because if Python *did* support it, this thread wouldn't
be happening.  (Or at least would have ended after someone 
replied with "oh, just do XYZZY to make a printraw statement".)

>Actually, your protest seems analogous to saying 'that isn't a
>shortcut to the highstreet because its a back alley - the normal route
>is a proper road'. In literal shortcuts, the classification of roads,
>back alleys, dirt tracks etc is irrelevant, and I see no reason to
>fuss about technicalities such as the type of syntax in an idiomatic
>use.

I'm not trying to be pedantic (at least, I think I'm not trying), but
the difference between a statement and a function is a semantic
difference, not (just) a syntactic one.

>Similarly, I cannot build my own custom dirt tracks and back alleys,
>yet I can still refer to existing ones as shortcuts.
>
>If there was some specialist definition of the word 'shortcut' in
>Python I might agree that David had made a poor choice of words, but
>I'm not aware of any and even if there is that doesn't make normal
>English usage invalid.
>
>'print' is a quick and convenient way of doing much the same thing as
>'sys.stdout.write'. It's a shortcut. I honestly can't see any logic in
>claiming otherwise.

The logic is that "much the same" is not "the same", and is the point
of the OP's plea.

In any case, I think the one-liner posted satisfies nearly all of the
requirements.  

import sys
def pr(*args): sys.stdout.write(''.join([str(i) for i in args]))

Where it fails is the difference between a function and a statement.
The OP said [one of] the advantages of a statement is that there is no
need for parenthesis.  This is the reason I brought up the point that
a function and a statement are semantically different, and why none of
the function-based suggestions will satisfy the OP's plea.

    --dangout



More information about the Python-list mailing list