[Python-Dev] PEP 343 - Abstract Block Redux

Josiah Carlson jcarlson at uci.edu
Sun May 15 17:52:47 CEST 2005


Shane Hathaway <shane at hathawaymix.org> wrote:
> 
> Nick Coghlan wrote:
> > That would be good, in my opinion. I updated PEP 3XX to use this idea:
> > http://members.iinet.net.au/~ncoghlan/public/pep-3XX.html
> > 
> > With that update (to version 1.6), PEP 3XX is basically PEP 343, but injecting 
> > exceptions that occur into the template generator's internal frame instead of 
> > invoking next().
> > 
> > The rest of the PEP is then about dealing with the implications of allowing 
> > yield inside try/finally statements.
> 
> You might add to the PEP the following example, which could really
> improve the process of building GUIs in Python:
> 
>     class MyFrame(Frame):
>         def __init__(self):
>             with Panel():
>                 with VerticalBoxSizer():
>                     self.text = TextEntry()
>                     self.ok = Button('Ok')
> 
> Indentation improves the readability of code that creates a hierarchy.

I've generally been fairly ambiguous about the entire PEP 310/340/343
issue.  While resource allocation and release is quite useful, not a
whole heck of a lot of my code has to deal with it.

But after seeing this sketch of an example for its use in GUI
construction; I must have it!

+1 for:
 - 'do' keyword (though 'try' being reused scratches the 'no new keyword'
itch for me, and is explicit about "I won't loop")
 - PEP 343
 - try/finally + @do_template with generators


 - Josiah



More information about the Python-Dev mailing list