Allowing Arbitrary Indentation in Python

Gary gfixler at gmail.com
Wed Dec 19 18:41:13 EST 2007


On Dec 19, 3:19 pm, Grant Edwards <gra... at visi.com> wrote:

> The problem is that to everybody else in the world, indentation
> in Python represents control flow nesting, not GUI widget
> nesting.

Thanks, Grant. That's the first solid reasoning I've seen, and it's a
very solid argument, as well. To that end, I'm thinking a few things.
For one, your argument correctly puts forth that using the code in 2
separate ways is not good. Despite doing just that for 6 years with no
problems, I can agree with you on that point. For another, I don't
really think the proposals, or hints at how to do it in Python are all
that great, either, because they create what I believe to be a bigger
mess.

I'm kind of leaning toward a Glade approach, wherein I wrap the UI
elements up with an XML parser (I'm sure those exist for me already),
and have some set of UI building functions build the UI for me with
the crappy Maya calls underneath, based on data extracted from the
XML. Then the UIs would be built as part of the parsing effort. This
sort of hides the ugly stepchild of the Maya method of creating UIs
under calls that each only do one thing, which rids the need to nest
anything directly in Python, and separates out the UI data into XML -
a language specifically made to be indented in a readable fashion,
perfect for UI information. The extra benefit is that UI snippets can
then be reused in the manner of templates, and even 'widgets,' from
which all of my UIs can potentially benefit. I'm sure there's more to
think about in regards to all of this, but it's not only the basis for
a game plan, but it has precedent in places like Glade, to suggest
that it's a viable, and decent option.

Again, thanks.
-g



More information about the Python-list mailing list