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/2005-May/053403.html below:

[Python-Dev] PEP 340 keyword: after

[Python-Dev] PEP 340 keyword: afterChris Ryland cpr at emsoftware.com
Thu May 5 16:55:18 CEST 2005
Rodrigo Dias Arruda Senra <rodsenra <at> gpr.com.br> writes:

>  The code pattern that will 'wrap' the block might
>  not always make sense with the chosen keyword, if
>  that keyword is not semantically neutral.
>  (not time-related, not function-related, etc).
> 
>  Notice that is _no keyword_ is chosen, nothing prevents us
>  from using (even if by aliasing):
> 
>    after_opening("/etc/passwd") as f:
>        for line in f:
>            print line.rstrip()
> 
>    after_locking(myLock):
>        # code that needs to hold the lock

I hate to add to what could be an endless discussion, but... ;-)

In this case, "while" is the better time-related prefix, whether
keyword (hopeless, due to ages-old boolean-controlled loop association)
or function, since you want to imply that the code block is going
on *while* the lock is held or *while* the file is open (and you also
want to imply that afterwards, something else happens, i.e., cleanup).

while_locked(myLock):
    # code that needs to hold the lock

--Chris Ryland, Em Software


More information about the Python-Dev mailing list

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