git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Blasphemy


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