Blasphemy

Chris Angelico rosuav at gmail.com
Thu Oct 24 18:58:59 EDT 2019


On Fri, Oct 25, 2019 at 9:54 AM Marek Mosiewicz
<marek.mosiewicz at jotel.com.pl> wrote:
>
> What about, if Python would have optional end keyword. In fact most of
> blocks have starting : sign. What if you would have also keyword to
> optionaly mark end of block.
>
> That would be big win for IDEs to format code and ensure that there is
> no problems with intendation. There could be some keyword to mark
> script as strictly marking blocks and then it would have this kind of
> validation.

Python already actually HAS support for an optional end keyword. It
does make your code uglier when you use it, though.

for factor in (2, 3, 4, 8):
    audio.frame_data = (data * factor).tobytes()
    try:
        sphinxamp = r.recognize_sphinx(audio)
    # end
    except (sr.UnknownValueError, sr.RequestError):
        continue
    # end
    if sphinxamp != sphinx:
        print("Sphinx*%d:" % factor, sphinxamp, file=log, flush=True)
    # end
# end

Fully supported by all current versions of Python.

ChrisA



More information about the Python-list mailing list