[Python-Dev] extended print statement, uPre-PEP

Barry A. Warsaw bwarsaw@beopen.com
Sun, 23 Jul 2000 23:10:07 -0400 (EDT)


>>>>> "PP" == Paul Prescod <paul@prescod.net> writes:

    >> have PP> "@" in it?  Forget about @, let's use >> instead.

    PP> Okay, but we're still inventing a new token that doesn't exist
    PP> otherwise in the language.

No we're not!  From token.h:

#define RIGHTSHIFT	35

    PP> There are two reasons I oppose this.

    PP> 1. On the one hand, we are making the print statement even
    PP> more of a special "syntax region" than it already is. In my
    PP> opinion that's newbie *unfriendly*. They learn how ">>" works
    PP> in one place and then when they look around for somewhere else
    PP> to use it, they won't find it. I think that that is profoundly
    PP> unpythonic.

Where would people look to use >> in this sense elsewhere?

    PP> 2. On the other hand, I oppose special case hacks *in general*
    PP> because when you solve a problem in one place, it doesn't
    PP> solve it elsewhere.  The benefits of print are:

    |  * no requirement for parens
    |  * newline by default
    |  * easy string coercion and interpolation
    |  * less thinking about whitepspace

    PP> Okay, but what about when I want these features elsewhere in
    PP> the Python language? At least the last three should should be
    PP> available everywhere in Python.

Don't these things mostly crop up in printing, in one form or
another.  I can imagine you might want to use something like #3.5 or
#4 when, e.g. building a string to be used as a regex, but in that
case, you already have #3.5 and #4, and probably don't want #2.  (We
won't even touch #1 in that context :).

-Barry