A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/032930.html below:

[Python-Dev] Extended Function syntax

[Python-Dev] Extended Function syntax [Python-Dev] Extended Function syntaxPaul Moore lists@morpheus.demon.co.uk
Mon, 03 Feb 2003 21:05:27 +0000
Oren Tirosh <oren-py-d@hishome.net> writes:

> I agree. I don't see anything wrong with
>
> f=open('spam', 'r')
> with autoclose(f):
>    ...

I *like* this way of doing autoclose files. Much better than the way
I've been thinking

    f = autocloser("spam")
    with f:
        ...

> and I think that 
>
> with autolock(obj):
>    ...
>
> looks better than any other alternative proposed so far.

On the other hand, I quite like

    with lock:
        ...

(where lock is defined appropriately).

I don't know. Does the fact that the same statement is best used in
two subtly different ways (permanent object vs throwaway helper
object) count as a disadvantage of the statement (in terms of
teachability, if nothing else...)?

Sigh. I'm *so* glad I'm just skimming the thunk discussion - I don't
think my brain would survive the details :-)

Paul.
-- 
This signature intentionally left blank



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4