gratuitous new features in 2.0

Thomas Wouters thomas at xs4all.net
Sun Aug 27 14:58:25 EDT 2000


On Sun, Aug 27, 2000 at 10:20:00AM +0100, Grant Griffin wrote:

[ Guido rejects 'print to <fileobj>, <args>' because it's 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 ">>"?

Yes, if you make 'to' a keyword, the parser doesn't care. But adding
keywords is a very bad thing: it breaks perfectly working code. Now, Guido
isn't against breaking bad code (indeed, he has!) but breaking good code is
bad form. And it's not like using 'to' as a variable name or method or
attribute name or anything is warned against, currently ! 

> 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.

Well, 'print to' cannot be done without making 'to' a keyword, and that's
currently very sensitive, because it also breaks things like 'object.to':
not just variable-names, but also attributes and such. There's talk (but no
code yet) to have *that* fixed, so that you can create a method or attribute
called 'print', for instance, but it isn't done yet, and it would still make
adding keywords tricky.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list