gratuitous new features in 2.0
Joshua Macy
amused at webamused.com
Fri Aug 25 10:17:13 EDT 2000
Robin Becker wrote:
>
> As Tim Peters seems to like having the generality of an argument to the
> print statement why can't we discuss this? Can I do
>
> print >> dingo, items....
>
> where dingo has a write method (perhaps a StringIO instance)?
>
> How about print >> (dingo, dongo, dango), items.....
>
> Why do we need the first comma?
I presume because print already expects a comma-seperated list of
items. Why is it so important to remove the comma that Guido et al need
to rewrite that portion of the parser?
> Why no discussion about which operator
> was to be overloaded. It seems to me that
>
> print 1>>x, thing
> print >>x, thing
> are now very close typing wise, but semantically miles apart.
>
So are x = 1 and x == 1, but that doesn't seem to bother anyone except
the people who want to make them equivalent (so they can have their if
target = expression: do something with target constructs).
> I personally would prefer
>
> print to filetypething items,......
>
> but no vote is to be taken on this. Perhaps the glorious leadership is
> becoming dicatorial.
The leadership has always been dictatorial. They don't call Guido the
"benevolent dictator for life" for nothing, you know.
Personally I think it's a good thing that print is going to grow some
usefulness. The reassignment of stdout just to be able to use a print
statement always struck me as something of a hack, and unPythonic to
boot. Anyone who wants writing to a file to be part of a method,
instead of a statement, already has that capability and will continue
to, but now print will be equally useful. I don't know if I would have
selected >> to overloadm but "to" and "in" would also be overloads, and
I can't see a strong reason to prefer one over another.
Joshua
More information about the Python-list
mailing list