[Python-ideas] Defer Statement
Juancarlo Añez
apalala at gmail.com
Sat Jun 3 19:59:13 EDT 2017
On Sat, Jun 3, 2017 at 6:59 AM, Daniel Bershatsky <bepshatsky at yandex.ru>
wrote:
Or with usage defer keyword
>
> ```
> fin = open(filename)
> defer fin.close()
> # some stuff
>
IMHO, a block in which the intention of a `finally: is not well understood,
needs refactoring.
Some *old* code is like that, but it doesn’t mean it’s *bad*.
Then, as a matter of personal preference, I’m not comfortable with that the
*defer* idiom talks first about things that should be done last. It’s a
debt acquired without enough syntactic evidence (Oh! Mi gosh!, There were
those defers at the start of the function I just changed).
>From import this:
Explicit is better than implicit.
--
Juancarlo *Añez*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170603/cbd4eb43/attachment-0001.html>
More information about the Python-ideas
mailing list