invalid-token syntax hook (was Re: Hack request: rational numbers)

Stefan Franke spamfranke at bigfoot.de
Wed Jan 31 10:38:27 EST 2001


>We *might* get somewhere being even less ambitious.  Perhaps by extending
>Python's grammar in a *fixed* way, so that every tool can learn to deal with
>it via "cheap tricks", and no compile-time hooks are needed to decide
>whether a piece of text *is* Python code.  The simplest thing I can think of
>would be to allow any letter as a prefix to a string (instead of just the
>[uUrR] allowed today), and ditto for a suffix on "a number" (instead of just
>[lL] today).

IHMO this is a very good idea, since I also had it before <wink>. Seriously, as
the extension language Python was designed to be, I think the lack of user 
definable literals is a gaping hole, especially compared to, say, Tcl.

At least it stopped me more than one time from writing an extension to interface
an existing library supporting various musical datatypes, whose notation 
is one of its most important adventages.

Being forced to include musical literals into run-time evaluated strings
invalidates one of its strongest points.

Stefan





More information about the Python-list mailing list