gratuitous new features in 2.0
Alex Martelli
alex at magenta.com
Tue Aug 29 03:54:27 EDT 2000
"Johann Hibschman" <johann at physics.berkeley.edu> wrote in message
news:mtaedxkoq5.fsf at astron.berkeley.edu...
> Tim Peters writes:
>
> > [Grant Griffin]
>
> >> *BTW, what's wrong with ">" for redirect? Heck, anything that both DOS
> >> and Unix do can't be _all_ bad! <wink>
>
> > To both Unix and DOS users, ">" implies overwrite and ">>" implies
append.
> > The print semantics are much closer to the latter. Ditto to the meaning
of
> > ">>" in C++ in an output context. Using ">" instead would *really* be
> > gratuitous novelty.
>
> True, ">" implies overwrite in sh, but I at least think of it as the
> more general "send this stuff to this place" operator, since I'm
> rarely appending to files. I suspect this is fairly normal.
Incidentally, '>>' is *NOT* used "in an output context" in C++; it's
exactly the REVERSE -- it is used for *INPUT*.
Output uses '<<' instead:
std::cout << "Hello, world\n";
while input would go like:
std::string aword;
std::cin >> aword;
Here, '>>' does NOT "append" anything; it *overwrites* the previous
contents of 'aword' (if any) with a word extracted from std input.
The analogies between shell, C++, and the new Python usage, are
just about close enough to be misleading, I think. Yet another
reason to think extending the print statement's functionality was
not a good idea, and adding a print-function would have been best.
Alex
More information about the Python-list
mailing list