[Python-Dev] PEP 343 - Abstract Block Redux

Shane Hathaway shane at hathawaymix.org
Sun May 15 10:42:46 CEST 2005


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.

Shane


More information about the Python-Dev mailing list