[Python-Dev] Python FAQ: Why doesn't Python have a "with" statement?

Simon Cross hodgestar at gmail.com
Sat Jun 14 22:22:22 CEST 2008


On Sat, Jun 14, 2008 at 9:53 PM, Cesare Di Mauro <cesare at pronto.it> wrote:
> Just take a look at the example I reported: don't you find it easier to read?

Sure, it's perhaps a bit easier on the eyes, but readability includes
understanding what's the code does.

Let's take an example:

>on Tkinter:
>   on ScrolledText.ScrolledText(master, width=60, height=37):
>     insert(END, self.log.getText())
>     configure(state=DISABLED)
>     see(END)
>     pack(fill=BOTH)

Is END an attribute of ScrolledText? Tkinter? Neither? Both? Who
knows. If we allow assignments it's even more painful. Throwing random
junk into the current scope isn't my idea of fun.

Schiavo
Simon


More information about the Python-Dev mailing list