On 09/29/2010 02:42 PM, Antoine Pitrou wrote:
 It seems like a slippery slope. Sometimes you really don't care like
 when you're just hacking together a quick script.

Isn't the "with" statement appropriate in these cases?

A hacked-together quick script might contain code like:

parse(open(bla).read())

Compared to this, "with" adds a new indentation level and a new variable, while breaking the flow of the code:

with open(bla) as foo:
    contents = foo.read()
parse(contents)

People used to writing production code under stringent guidelines (introduced for good reason) will probably not be sympathetic to quick-hack usage patterns, but Python is used on both sides of the fence.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to