Proposal for new operators to python that add syntactic sugar for hierarcical data.
bruno at modulix
onurb at xiludom.gro
Thu May 18 09:34:18 EDT 2006
glomde wrote:
>>Adding ugly and unintuitive "operators" to try to turn a general purpose
>>programming language into a half-backed unusable HTML templating
>>language is of course *much* more pythonic...
>
>
> IT is not only for HTML. I do think html and xml are the biggest
> creators of
> hierarcical treestructures.
What is a 'non-hierarchical treestructure' ? A list ?-)
> But it would work for any package that
> manipulates,
> creates hierarchical data.
FWIW, filesystems are trees, most RDBMS use BTrees, and almost any OO
program is a graph of objects - trees being a subset of graphs..
Strange enough, working with trees is nothing new, and it seems that
almost anyone managed to get by without cryptic 'operators' stuff.
> I used HTML as example since it is a good
> example and
> most people would understand the intention.
Sorry for being dumb.
> But could you elaborate on your comment that it is unusable.
Ask all the coders that switched from Perl to Python why they did so...
> Do you
> think all template systems are unusable
Nope - I use template systems everyday.
Please don't take it wrong: there's surely something to do to ease
declarative XML-like (including JSON, Yaml etc...) datastructure
construction. But I think the pythonic way to go would rely on
metaprogramming - not on ugly perlish syntax.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list