A counter-proposal to __future__ in PEP 236

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Mar 2 16:52:04 CET 2001


"Tim Peters" <tim.one at home.com> writes:

> It's not possible-- in Python's parser --to make the identifier
> "directive" a keyword in some contexts but not others

Sure it is; my patch does that. It is even possible to implement the
syntax that Joshua wants to have, it is just not easy.

> You also have to consider the parsers in tools, from the Emacs
> python-mode thru whatever the heck PythonWorks uses.

The Emacs Python mode deals just fine with the proposed syntax as it
is now; i.e. it does not highlite directive (as it might do in some
future release), however, its indentation behaves just fine even in
presence of directive. Once it knows that directive is a keyword
(i.e. by adding it to the kw1 list), it will highlite it in all
contexts (even if used as an identifier) - just as it does for, say,
print.

I don't know whatever the heck PythonWorks uses, so I don't know
whether it would break. My guess is that it would not.

> Doesn't mean it can't be hacked, but it's ugly, and you have to get
> a lot of different people to sign up to do all that hacking.

That's only for the transitional period for introducing the new
keyword; I firmly believe that most tools will continue to work as
much as reasonable, instead of outright breaking, even if they are not
touched at all.

Regards,
Martin




More information about the Python-list mailing list