Great exercise for python expert !

Diez B. Roggisch deets at nospam.web.de
Fri Nov 28 10:55:36 EST 2008


Steven D'Aprano wrote:

> On Fri, 28 Nov 2008 02:36:28 -0800, manatlan wrote:
> 
>> I'd like to make a "jquery python wrapper"
> [...]
>> here is my code :
> [...]
> 
> What is the purpose of this code? As near as I can see, it would make an
> excellent entry to the Obfuscated Python Competition, except it isn't
> clear that it does anything useful.
> 
> Frankly, this looks like an pointlessly overly-complicated design to me.
> Rather than getting rid of the extra parentheses, I suggest you rethink
> your design. Explicit is better that implicit: don't have the one method
> do both appending to the object *and* calling the object.

The basic idea isn't so bad. The OP tries to create a syntactic look-alike
to the way the javascript library jQuery works, which does these chained
calls, with the purpose of making the writing of JS serverside (something
you sometimes for dynamic JS) within the same DSL.

If this is nicely integrated, it actually could be neat. OTOH, I go
with """-strings & string interpolation - works good enough for me...

Diez



More information about the Python-list mailing list