gratuitous new features in 2.0

Grant Griffin g2 at seebelow.org
Sun Aug 27 05:20:00 EDT 2000


Guido van Rossum wrote:
> 
> Hey folks, I am aware of this thread.  Think of this reply as a lesson
> in Pythonic thinking. :-)

BTW, I stumbled upon the following definition of "pythonic" in Websters:
"of or lie an oracle; oracular; prophetic".  I'm glad to get some free
lessons in that. ;-)

...
> If we want to use a special symbol (print <symbol> expression), the
> Python parser requires that it is not already a symbol that can start
> an expression -- otherwise it can't decide which form of print
> statement is used.  (The Python parser is a simple LL(1) or recursive
> descent parser.)
> 
> This means that we can't use the "keyword only in context trick" that
> was used for "import as", because an identifier can start an
> expression.  This rules out +stderr, [sterr], and to stderr.  It
> leaves us with binary operator symbols and other miscellaneous symbols
> that are currently illegal here, such as 'import'.
> 
> If I had to choose between 'print in file' and 'print >> file' I would
> definitely choose '>>'.  In part because 'in' would be a new invention
> (I know of no other language that uses it, while '>>' is used in sh,
> awk, Perl, and C++), in part because '>>', being non-alphabetic,
> stands out more so is more likely to catch the reader's attention.

The point about "stands out" is well taken...but I had kindda thought
that it was better that it _didn't_ stand out.  (What was that quote
about yelling, "Fire!" in a crowded theatre? ;-)

...
> [Robin Becker, in a later post]
...
> > I personally would prefer
> >
> >         print to filetypething items,......
> >
> > but no vote is to be taken on this. Perhaps the glorious leadership is
> > becoming dicatorial.
> 
> It was proposed, considered, and rejected on the grounds explained
> above (the syntax would be ambiguous).

I don't know much about language parsing, but as I understand your
explanation at top, doesn't this point apply only if "to" is a "keyword
only in context"?  That is, if "to" is _always_ a keyword, doesn't that
solve the problem?  (I guess it causes a diffrent problem--a certain
amount of broken code--but that's the tradeoff.)  In that case, isn't
"to" just the same parsing-wise as ">>"?

If the intent is to make the special symbol stand out, I guess ">>" is
as good a choice as any (if not better <wink>), but if there's merit in
making it "fit in", much as the "in" part of "for x in y" fits in very
nicely, I'm still voting for "to"--if it can possibly be done.

(then-again-even-if-this-weren't-a-benevolent-dictatorship,-i'm
   -not-even-old-enough-in-python-to-vote-<wink>)-ly y'rs,

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation	      http://www.iowegian.com



More information about the Python-list mailing list