On Sun, May 12, 2019, 3:33 PM Gustavo Carneiro <[email protected]> wrote:
> # Hypothetical future labelled break:
>> def find_needle_in_haystacks():
>> for haystack in glob.glob('path/to/stuff/*') label HAYSTACKS:
>> fh = open(fname)
>> header = fh.readline()
>> if get_format(header) == 'foo':
>> for line in fh:
>> if process_foo(line) == -1:
>> break HAYSTACKS
>> elif get_format(header) == 'bar':
>> for line in fh:
>> if process_bar(line) == -1:
>> break HAYSTACKS
>>
>
> Nice. Suggestion:
> 1. replace "label HAYSTACKS" with "as HAYSTACKS", if possible, so no new
> keyword is introduced;
> 2. replace "break HAYSTACKS" with "break from HAYSTACKS"
>
I thought of 'as' initially, and it reads well as English. But it felt to
me like the meaning was too different from the other meanings of 'as' in
Python. I might be persuaded otherwise.
Likewise, 'from' isn't really very similar to other existing uses.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/