[Python-Dev] ANN: PEP 335: Overloadable Boolean Operators
exarkun at divmod.com
exarkun at divmod.com
Tue Sep 14 15:32:33 CEST 2004
On Tue, 14 Sep 2004 08:04:45 -0400, Kevin Jacobs <jacobs at theopalgroup.com> wrote:
>Phillip J. Eby wrote:
>
> > For these reasons, I'd feel more comfortable with either a literal
> > syntax (to address algebra, SQL, etc.) or some type of special infix
> > notation to allow new operators to be defined in Python, so that it
> > isn't necessary to use prefix or method notation to perform operations
> > like these. Neither of these solutions burdens applications that
> > don't need the feature(s).
>
> Both of your alternatives are being used in some form and
> neither is really satisfactory. Literal representations require
> complex parsers, when the Python parser is really what is
> desired.
Python's parser is already available, through the compiler module. The example given earlier, query("x and y or z"), is relatively straightforward to implement as a set of AST manipulations.
Jp
More information about the Python-Dev
mailing list