python hack of the day -- "listable" functions

Jim Meier fatjim at home.com
Sat May 15 14:01:10 EDT 1999


William Tanksley wrote:

> Now, consider this.
>
> x = o.verb(a,b,c)
>
> You've created a language feature where the action of the verb depends not
> on the single object it's attached to, but on EACH of the parts of speech
> in its parameter list.
>
> After that change, Python wouldn't be object oriented.  It'd be grammar
> oriented.
>
> Let that one sink in for a while.
>

I think grammar-oriented languages are a very, very interesting idea. I saw a
posting somewhere(freshmeat.net?) about a language whose modules were allowed
to define and maybe redefine syntax. struck me as neat, but to wrap it together
and call it "grammar".. could we "conjugate" verbs for different effect?? wow..



>
> Ouch.  Has anyone done work on how to do that?  It's polymorphism, but
> with the action depending on every parameter rather than just one.

How is it different from normal polymorhpism? The language (if it cares) would
dispatch to the member function whose signature matched the parameters. This is
normal in many OO languages (C++ being the first to come to mind)

-Jim.





More information about the Python-list mailing list