[Python-Dev] extended print statement, uPre-PEP
Sun, 23 Jul 2000 22:55:36 -0400
> I'm not sure how Python's parser manages to get that [``1+2`+`3+4``]
> straight! In Prescodese, it would be (except that $(x) is presumably
> str(x) rather than repr(x)):
> print $"$($(1+2)+$(3+4))"
> which at least makes the grouping clear. I'm all for it.
> Egad. It's enough to make me think twice about my own proposal. :)
> Nevertheless, I agree it's clearer than your tick-example which almost
> made me run for my plotted plant.
Yes, both examples suck, but distinct left & right bracketing characters at
least make the extremes tractable. They also make the usual cases obvious,
as some of us have learned from languages that suck <wink>.
> As happy as I am to have it called Prescod-ese, I admit to influence
> from some languages that (otherwise) suck. :)
Indeed, if Perl got the philosophy wrong but many details right, then Python
may be open to the opposite critique. BTW, triple-quoted strings got added
to Python after I whined (& whined, & whined) on c.l.py that I was writing
some block-output generating programs in Perl because pasting screen-width
strings with explicit newlines together was driving me nuts in Python.
Wouldn't be the first time we stole the heart of a decent detail from Perl!
"%(name)format" % dict
is great (& better than Perl) for fine-grained control of formatting, but
we're missing Perl's ease in the vast area between that and what plain
"print" can do. Perl's got nothing to be ashamed of here: Larry looked at
the mass of insanely convoluted quoting and interpolation rules from the
Unix shells and from Tcl, and came up with something downright Pythonic in
its uniformity and simplicity. Except he couldn't resist pushing it too far
(e.g., trying to *guess* whether "" are literal characters or an indexing
operator in "$a[$b]").
BTW, at the time, half the people on c.l.py complained that triple-quoted
strings were unnecessary feature bloat too. Jeez, if I cared about what was
*necessary*, I'd program in Scheme <0.3 wink>.
BTW too, in "There should be one-- and preferably only one --obvious way to
do it", "obvious" doesn't mean instantly understandable to someone from
Mars. Nothing in computer languages is obvious in that sense. It means
more "easy to learn and hard to forget once you know it", and that the vast
majority of people who know the language are likely to spell it the same
way. Sequence slicing is the perfect example: newbies are routinely
baffled by it, but once they get it they never lose it, and all of us use
it. Pushing and popping sys.stdout doesn't qualify as obvious that way,
ditto the twenty ways to paste the output you want together by hand now
(note that whenever this pops up on c.l.py, about as many alternatives are
suggested as there are responses -- unPythonic).
we-can-leave-python-alone-when-it-finishes-becoming-python-ly y'rs - tim