Proposal for new operators to python that add syntactic sugar for hierarcical data.

Heiko Wundram me+python at modelnine.org
Thu May 18 18:30:49 CEST 2006


Am Donnerstag 18 Mai 2006 15:17 schrieb glomde:
>  > nothing general the OP is trying to achieve here
>
> Define general :-). I do think I solve something and make it more
> readable.
> You could also argue that list comprehension doesnt solve anything
> general.

Sure, a list comprehension solves something general. It's syntactic sugar for 
a recurring pattern in a for loop.

What you are trying to achieve is to make syntactic sugar for making namespace 
definitions look nicer. But: the way you are trying to do so isn't pythonic, 
because there isn't one obvious way how your proposal works; you're not even 
specifying a proper semantic interpretation of your syntax (and use "magic" 
markers, which is even more a NoNo).

For a better thought out proposal (IMHO) for stacking and defining namespaces 
(based on the current metaclass behaviour), look for the PEP on the "make" 
keyword (which was sent to Py-Dev some weeks ago).

> > By the way: the language you (the OP) are trying to implement here goes
> > strictly against the MVC model of application programming. You know that,
> > right?
>
> ???. I cant see how this breaks MVC. MVC depends on how you parition
> your application
> this doesnt put any constraint on how you should do your application.

Sure it does.

In case you implement a templating language that simply contains the "full" 
power of the Python language, you create a (somewhat) cripled PHP, basically. 
The View part of MVC shouldn't do branching (well, in the strict sense of 
MVC), shouldn't do looping, shouldn't do modification of the data, all that 
stuff is up to the controller.

If you empower the template writer with the full power of the Python 
programming language by integrating your proposal with Python itself, you're 
bound to water down the split between the three, and to create a maintenance 
nightmare (as I said, PHP comes to mind, where you basically can't split 
controller from model properly).

For a proper (and pretty strict) MVC templating language, have a look at 
Nevow.

--- Heiko.



More information about the Python-list mailing list